-
Notifications
You must be signed in to change notification settings - Fork 0
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
Fork ember-url-hash-polyfill and remove 2-second delay for our use case #1
Conversation
@@ -117,7 +115,7 @@ async function setupHashSupport(router: EmberRouter) { | |||
|
|||
const CACHE = new WeakMap<ApplicationInstance, MutationObserver>(); | |||
|
|||
async function eventuallyTryScrollingTo(owner: ApplicationInstance, url?: string) { | |||
function eventuallyTryScrollingTo(owner: ApplicationInstance, url?: string) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this need to be called eventually try scrolling if there is no longer a delay?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably not - I was trying to minimize changes to the original project, but if people feel strongly about it, I can rename.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🦎
return resolve(totalTimeWaited); | ||
} | ||
|
||
schedule('afterRender', requestTimeCheck); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is the actual bug here, it will always mutate DOM.
See https://github.com/emporatitle/ember-url-hash-polyfill#ember-url-hash-polyfill for the rationale for
ember-url-hash-polyfill
's existence.For Empora, the lack of support in Ember for page anchors is preventing us from being able to route back to the action items section of the deal page after creating/updating an action item, and as we continue to build functionality in Ember, it'll be expected that this basic browser functionality will be supported.
I've been able to get the original
ember-url-hash-polyfill
working with Reggie, but it has a hardcoded delay while it waits for animation frames to finish, which means it takes 2 seconds to scroll down to the page anchor, at which point the user has probably already scrolled away to wherever they want to go.Because we don't have a ton of animation in Reggie (and are unlikely to add much in the future), this delay can be removed for our use case.
As recently as August 2022, a member of the core Ember team said that they were working on first-class support for this problem (emberjs/rfcs#709 (comment)), so hopefully this fork is temporary. If it proves not to be, I may PR a change to the original
ember-url-hash-polyfill
to make this configurable instead.