-
-
Notifications
You must be signed in to change notification settings - Fork 407
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 for links with fragment identifiers #330
Comments
Great idea!
I believe this could be the most complex point to handle. The location.hash = `#${hash}`; Or what ever may be more ember-y (if Ember has a different reference to the Then there's the whole point about scrolling to anchor hashes within the same page (or route, actually). I must confess I am quite ignorant about this, but I'm sure someone with more knowledge about the matter can chip in. Hope we can get to define a good strategy for this, it's sorely missed for anyone wanting to develop a complex website or web application in Ember with attention to standards. |
After some investigation, I've found that the addon I'm not familiar with the inner workings of the router, and it scares me. If someone out there could point me at the right files in the router to look at, I could probably figure it out enough for the purposes of supporting fragment identifiers. |
I'm closing this due to inactivity. This doesn't mean that the idea present here is invalid, but that, unfortunately, nobody has taken the effort to spearhead it and bring it to completion. Please feel free to advocate for it if you believe that this is still worth pursuing. Thanks! |
I think this is very closely related to #709 |
Background
The HTML5 standard specifies (basically) that if there is a fragment identifier as part of a link (and if an element with that id exists in the resource), then the browser should scroll to that section. It's fairly standard browser behavior and developers have come to expect & rely upon it.
There's an addon for that however it's unclear if it works in FF or IE or if it's still maintained.
The behavior is simulated using query params on Ember API docs, however if developers wish for similar functionality in their apps, that exercise is left to the reader.
Users
Users may find apps built with Ember frustrating, as they may wish to be able to link to sections on pages, and even if that section has an
id
, they'd find their links don't properly scroll to thatid
.Suggested API
I don't believe this would require a special helper (like
(query-params)
) because it's just a simple string. I prefer passing it as a named argument because it's easy to use and you wouldn't need to useconcat
to use a variable.emberjs/ember.js#12997 (comment) suggests a different API however it would require
concat
to use a variable.Rendering Note
Obviously after rendering, Ember would need to check the URL for a fragment identifier, find an element with a matching
id
orname
, and scroll to it.The text was updated successfully, but these errors were encountered: