Skip to content

[Feature] AnchroScrollTo: add support for updating the URL hash #186

Draft
antoine4livre wants to merge 1 commit into
mainfrom
feature/AnchorScrollto-hash-cloak
Draft

[Feature] AnchroScrollTo: add support for updating the URL hash #186
antoine4livre wants to merge 1 commit into
mainfrom
feature/AnchorScrollto-hash-cloak

Conversation

@antoine4livre

@antoine4livre antoine4livre commented Mar 21, 2024

Copy link
Copy Markdown
Contributor

❓ Type of change

  • 📖 Documentation (updates to the documentation, readme or JSdoc annotations)
  • 🐞 Bug fix (a non-breaking change that fixes an issue)
  • 👌 Enhancement (improving an existing functionality like performance)
  • ✨ New feature (a non-breaking change that adds functionality)
  • 🧹 Chore (updates to the build process or auxiliary tools and libraries)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

📚 Description

Add the update of the hash in the url after animation complete and add an option to disable it.

📝 Checklist

Feature todos

PR todos

  • I have linked an issue or discussion.
  • I have added tests (if possible).
  • I have updated the documentation accordingly.
  • I have updated the changelog.

@antoine4livre antoine4livre self-assigned this Mar 21, 2024
@github-actions

github-actions Bot commented Mar 21, 2024

Copy link
Copy Markdown

Export Size

@studiometa/ui

Name Size Diff
AnchorScrollTo 308 B +65 B (+26.75%) 🔺
TableOfContentAnchor 603 B +53 B (+9.64%) 🔺
TableOfContent 782 B +40 B (+5.39%) 🔺
ATOMS 3.8 kB +36 B (+0.96%) 🔺
MOLECULES 6.99 kB +44 B (+0.63%) 🔺
ALL 11.22 kB +33 B (+0.30%) 🔺
Unchanged

@studiometa/ui

Name Size Diff
AbstractPrefetch 411 B -
AbstractScrollAnimation 461 B -
AbstractSliderChild 2.46 kB -
Accordion 1.06 kB -
AccordionItem 1.02 kB -
Action 508 B -
animationScrollWithEase 272 B -
CircularMarquee 339 B -
Cursor 665 B -
Draggable 327 B -
Figure 694 B -
FigureTwicpics 1.15 kB -
Frame 1.62 kB -
FrameAnchor 201 B -
FrameForm 198 B -
FrameTarget 777 B -
LargeText 492 B -
LazyInclude 418 B -
loadImage 694 B -
Menu 1.38 kB -
MenuBtn 230 B -
MenuList 943 B -
Modal 908 B -
ModalWithTransition 1.02 kB -
ORGANISMS 1.68 kB -
Panel 1.26 kB -
PrefetchWhenOver 468 B -
PrefetchWhenVisible 480 B -
PRIMITIVES 632 B -
ScrollAnimation 513 B -
ScrollAnimationChild 650 B -
ScrollAnimationChildWithEase 851 B -
ScrollAnimationParent 712 B -
ScrollAnimationWithEase 711 B -
ScrollReveal 622 B -
Sentinel 217 B -
Slider 2.26 kB -
SliderBtn 2.62 kB -
SliderCount 2.49 kB -
SliderDots 2.7 kB -
SliderDrag 353 B -
SliderItem 733 B -
SliderProgress 2.54 kB -
Sticky 859 B -
Tabs 625 B -
Transition 387 B -

@codecov

codecov Bot commented Mar 21, 2024

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 8 lines in your changes missing coverage. Please review.
✅ Project coverage is 28.19%. Comparing base (7e6c2f0) to head (f99e5e1).
⚠️ Report is 1063 commits behind head on main.

Files with missing lines Patch % Lines
packages/ui/atoms/AnchorScrollTo/AnchorScrollTo.ts 0.00% 6 Missing and 2 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #186      +/-   ##
==========================================
- Coverage   28.33%   28.19%   -0.14%     
==========================================
  Files          49       49              
  Lines        1246     1252       +6     
  Branches      239      231       -8     
==========================================
  Hits          353      353              
+ Misses        893      830      -63     
- Partials        0       69      +69     
Flag Coverage Δ
unittests 28.19% <0.00%> (-0.14%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
packages/ui/atoms/AnchorScrollTo/AnchorScrollTo.ts 7.69% <0.00%> (-6.60%) ⬇️

... and 19 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

return;
}

window.location.hash = this.targetSelector;

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Can we avoid the problem with a specified offset ?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

historyReplace({ hash: 'hello-world' });

@titouanmathis titouanmathis marked this pull request as draft March 22, 2024 13:19
@antoine4livre antoine4livre force-pushed the feature/AnchorScrollto-hash-cloak branch from 127357f to f99e5e1 Compare March 27, 2024 16:07
return;
}

window.location.hash = this.targetSelector;

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

historyReplace({ hash: 'hello-world' });

* @returns {void}
*/
onClick(event) {
async onClick(event) {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Suggested change
async onClick(event) {
async onClick(event) {
if (
this.$el.pathname !== window.location.pathname ||
this.$el.origin !== window.location.origin
) {
return;
}

@titouanmathis titouanmathis changed the title [Feature] Hash cloak option on AnchorScrollTo (WIP) [Feature] AnchroScrollTo: add support for updating the URL hash May 12, 2025
@titouanmathis titouanmathis changed the base branch from develop to main March 25, 2026 11:20
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.

1 participant