Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support anchor links in HTML model #7258

Merged
merged 10 commits into from
Sep 12, 2024
Merged

Support anchor links in HTML model #7258

merged 10 commits into from
Sep 12, 2024

Conversation

philippjfr
Copy link
Member

Searches rendered HTML contents for anchor links and then does two things:

  • If document is still initializing will scroll the anchor linked in the URL into view
  • Attach click event listeners on all anchor links to ensure that they work across the shadow DOM

Fixes #6156

Copy link

codecov bot commented Sep 12, 2024

Codecov Report

Attention: Patch coverage is 69.23077% with 8 lines in your changes missing coverage. Please review.

Project coverage is 82.22%. Comparing base (d5e2155) to head (568e865).
Report is 5 commits behind head on main.

Files with missing lines Patch % Lines
panel/tests/ui/pane/test_markup.py 69.23% 8 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #7258      +/-   ##
==========================================
- Coverage   82.24%   82.22%   -0.02%     
==========================================
  Files         337      337              
  Lines       50293    50348      +55     
==========================================
+ Hits        41362    41398      +36     
- Misses       8931     8950      +19     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

panel/models/html.ts Outdated Show resolved Hide resolved
Copy link
Member

@hoxbro hoxbro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One small comment

@MarcSkovMadsen
Copy link
Collaborator

Will this also work when updating page dynamically?

@philippjfr
Copy link
Member Author

Will this also work when updating page dynamically?

Yes

@philippjfr philippjfr merged commit d90097b into main Sep 12, 2024
16 checks passed
@philippjfr philippjfr deleted the html_scroll_into_view branch September 12, 2024 13:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Shadow DOM prevents anchor links to other elements from working
3 participants