-
Notifications
You must be signed in to change notification settings - Fork 72
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
Scroll To Text Fragment #194
Comments
I guess it would help to summarize some of the issues I've seen:
(Also, if that highlight API comes of the ground I suppose it better be isolated from these highlights somehow.) Overall though it seems like a useful feature to have. |
FWIW in my review of the spec I found the processing model fairly clear and precise. The entry point that you might find most clarifying are:
That said, it does appear that the draft spec does currently modify the URL parser/serializer. But the way in which it does so seems unobservable to any part of the ecosystem that doesn't specifically look at the "URL's fragment directive" concept. So I think it could be refactored transparently (i.e. with no testable effects) to put that parsing entirely in HTML (in particular in the first link above). Edit: I see that there is an issue filed to perform that refactoring, at WICG/scroll-to-text-fragment#60. |
I agree. I opened WICG/scroll-to-text-fragment#66 |
Update: I think we've addressed points 1 and 2 (the latter in a yet to be merged PR WICG/scroll-to-text-fragment#70). Here's how the spec looks with the latter PR merged. I agree with point 4 but I think this can be done as part of some cleanup at the time we'd merge this into the HTML spec. I don't think it's an issue with the feature itself or hinders interop for following implementations. Re: point 3: In addition to privacy, stripping the directive from the URL prevents the directive from interacting with author script in unexpected ways (see issues raised in WICG/scroll-to-text-fragment#15). It's true that there is some risk here to non-implementing UAs. We believe the risk is low. Since the delimiter appears inside the fragment, a non-implementing UA will interpret it as a non-matching element-id fragment. In most cases this means such URLs will load at the top of the page which is a graceful fallback. The one concern is pages that use the fragment for state. We've found pages like this that interact badly with the directive to be rare and think the benefit outweighs the risk. As a (small) mitigation we could add a note in the spec/explainer/outreach to recommend users and tools avoid amending URLs that already have a fragment for now as well as feature detecting (where possible) whether the UA supports directives. WDYT? |
Post US-holiday ping. Would it be possible to get an official Mozilla opinion on this feature? |
There's been some discussion on twitter so I'm going to consolidate it here so it doesn't get missed: On why we invented a new thing rather than implement fragmention (which is basically interpreting the fragment as the search string):
|
I'd also point out that we've engaged and taken feedback from several experts in this space ( WICG/scroll-to-text-fragment#4 is a good example). That issue has posts from the author of fragmentation, founder of hypothes.is and others (I believe related to web-annotations). IMHO, we've been (and will continue to be) openly receptive and grateful for the feedback we've gotten as it definitely improved the outcome - we didn't build this in a vacuum. |
Just to be clear, no one is saying you built this in a vacuum; we're just trying to evaluate the proposal and trying to gather as much information as we can so the evaluation can be informed by that. |
https://bugs.chromium.org/p/chromium/issues/detail?id=961440 is relevant here as an example of #194 (comment) item 1 -- webmd has issues when it sees a fragment that it does not control. |
My high-level opinion here is that this a really valuable feature, but it might also be one where all of the possible solutions have major issues/problems. So I think the question we should think about is how the problems of the solution chosen here compare to the problems of other options and how they compare to the value of the feature. |
@tantek and I looked through:
and various issues on the ScrollToTextFragment repo. We have various concerns about this standards proposal. Some of the problems it has (e.g. lack of clear processing model) are shared by #234 as well. Also, both proposals fail to address some use cases (e.g. highlighting the entirety of a particular row on https://www.x-rates.com/table/?from=USD&amount=1) that came up during our discissions about this. Those use cases might be better-served by some other XPointer-like mechanism, possibly; more investigation is needed there. A draft position we are proposing: Summary position: “non-harmful” bordering on harmful (could be convinced) There are various use cases that this sort of API could address:
Our general feeling is that some of these use cases are very important to address, but that the specific proposed solution of ScrollToTextFragment is highly biased towards the “search engines” use case and has some aspects that are harmful to the future development of the web, insofar as they encourage the creation of fragile links (so either “harmful” overall or averaged with “worth prototyping” to a summary position of perhaps “non-harmful”). We think it’s worth prototyping this proposal with the harmful aspects removed. Specific notes we had:
|
Thank you for the detailed feedback, there's definitely some helpful points in here and we're working on addressing these. We'd be happy to have Mozilla's (or others') help, contributions, and expertise where they can provide it.
I'd like to clarify that, while the machine-generated search-engine use case was one we worked on, from the very beginning a primary use case has been the user sharing case (select text > context menu > "copy link to text") and are actively prototyping browser UI to make this happen. I agree there's room for debate about certain design decisions but I think the above mischaracterizes the rationale. We've put together a doc to address some of the questions around use cases and provides representative examples; I reference it below. I'm going to incorporate this into the explainer but it's in a Google Doc for now; I realize a complaint was this should have been there from the start but the explainer is already close to a thousand lines so we were trying to keep it focused and accessible - I'll give it a refresh to make it more relevant to the current state and reflect your feedback. I've replied below to each of the specific points - going forward, is this issue the best place to carry on these discussions or would you prefer we file bugs (where we don't have one yet) for each point in our repo instead?
We're in agreement here. Giving authors more control over the directive will allow use cases like Marginalia as well as handling dynamically loaded content/infinite scrollers more reliably. We've punted on it for V1 since there's lots to carefully think through and we didn't want to lose focus. We have considered that we'd want to add things like this in the future and assumed The primary reason for stripping the
I think there's clear examples from social media that this is something users want and are already doing with less linkable tools. E.g. tweet, lots more examples in the doc. Additionally, this is helpful in cases where text is interrupted by unwanted elements like tables/ads as well as for selecting multiple items where the DOM structure isn't purely textual (e.g. tables, lists). We've put together some motivating examples in this section of our doc. Additionally, we see this as adding only minimal complexity. The user experience / full-document scan point we think is unlikely to be a problem in practice but we can probably specify things to avoid the full-document scan for all but the first match (since they don't cause scrolling and can be done asynchronously). I'll give this some more thought.
This was originally motivated by being able to select text across DOM nodes. e.g. Consider a The above is now also possible by specifying each node (e.g. each A case we're concerned about is a user highlighting a long passage (e.g. 2-3 paragraphs). Pasting a link like that in a chat window, for example, would lead to poor UX (consider that each space has to be percent encoded). That said, I agree we should find some way to have usage prefer the non-range format. We're open to changes here - e.g. perhaps only allowing start/end format above a certain long length so that the vast majority of cases are forced to use the less fragile exact format?
Here are some more detailed examples from our experiments with Search. I think the difference from fragmentation is that 1) this will apply across a much broader set of content (pages have to opt-in to fragmentation which biases the population of both pages and users) and 2) users will be easily able to generate these links arbitrarily and on arbitrary content. It would be confusing for users if the generated link pointed to a different part of the document than they had selected. An additional signal here is that the WebAnnotation community reached the same conclusion, see their syntax and motivating example. In addition to the base reasoning, we believe there is additional value in having Web Annotation references and text fragment directives be easily convertible and interoperable. Tools that generate these kinds of links can use heuristics to determine when additional context is needed. e.g. if the desired snippet is more than 2-3 words long and currently unique it's probably a good sign the context can be omitted. There's also a counter-example to the fragility argument here in that a short snippet (e.g. one word) without context might point to one part of a document but later point elsewhere if the document is modified and a new instance of the word is added above. IMHO, this would actually be more confusing than if the context changes and the link now just points to the top of the page. Additionally, if the context changed, it's likely the text you wanted to point to also changed.
I believe both of these are basically unintentional side-effects/bugs in our reasoning. The case of a user modifying their URL with a text directive and performing a same-doc navigation should definitely work and we'll fix that. The original motivation for blocking same-document navigations was "defence in depth". If a page did find a way to cause the navigation and detect the scroll, doing so from a same page navigation would make it trivial to extract any text. However, we've since gotten to a much clearer "noopener context" restriction which might be sufficient on its own. We'll look into dropping the same-doc restriction altogether.
Sorry about that, we'll work on fixing this ASAP. |
In addition, Blink now has an intent to ship support for the |
It's been a while so I'll summarize where we currently stand. It'd be much appreciated if anyone at Mozilla would like to help work through any outstanding issues or improvements. Outstanding Issues3. The capability to include multiple fragment specifiersOur current stats show ~25% of text-fragment invocations have 2 or more selectors. Motivation (for both user and generated) provided in this section of our doc. The complexity to support this seems quite low to me. 4. The capability to specify textEnd instead of the full text to highlightAgree there's a balance here; however, the There's also a counterargument to link fragility - the longer a passage becomes, the more brittle an exact quote becomes. e.g. if the author fixes a typo anywhere in the passage. Ranges alleviate this somewhat. 5. The capability to specify a prefix and suffix likewise introduces fragilityFrom our stats, about 5% of text fragment URLs provide a prefix/suffix. Motivating use cases here. From personal usage, I've found this necessary quite often. E.g. quoting a heading section on Wikipedia requires context since the TOC at the top includes each section; this is quite common. Motivation for this is also backed up by @dwhly and others in WICG/scroll-to-text-fragment#4 (comment) who have ample experience with annotating web content. Updates1. The
|
What is Mozilla's current position on what Chrome has shipped for Scroll to Text Fragment? Have the harmful aspects been removed? Are Fragment Directives a good basis for building future APIs, such as Chrome's new App history API proposal? |
FWIW - the fragment directive idea ( As far as the harmful aspects, I disagreed above that the ability to specify multiple fragments and prefix/suffix are harmful, I haven't heard any feedback on those points. I feel pretty strongly from our experience, and others' in the annotation community, that prefix/suffix is critical. Multiple fragments isn't critical but helpful in some cases and doesn't add much complexity - an implementation that only highlights the first matching fragment would be meaningfully interoperable with ours, so perhaps that part of the spec could be made MAY or SHOULD, rather than MUST. I understand and share the concern about allowing a FYI: Chrome is soon shipping a right-click menu item "Copy Link to Text", you can try it out already via chrome://flags/#copy-link-to-text. I've been finding this very helpful for a long time now (via the official and popular extension), for example, to link to explicit statements in specifications. The main drawback has been that these links don't work outside of Chrome today. It would be awesome if we could make this work across browsers. |
Broadly speaking, we think that linking to text would be a nice feature for the Web. We've also seen some potential reasons for concern around privacy leaks. We think they're probably addressable with the right mitigations, but intend to take a cautious approach and give the security community time to scrutinize the implications before we consider prototyping something here. In the mean time, we think it would be premature to use this technology as a basis for other standards. |
The "official" extension is likewise available for Firefox. |
Yeah, I saw that. From what I understand it only creates those links, not
actually open them in Firefox?
…On Sun, 16 May 2021 at 23:57, Thomas Steiner ***@***.***> wrote:
The "official" extension is likewise available for Firefox
<https://addons.mozilla.org/en-US/firefox/addon/link-to-text-fragment/>.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#194 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABQ5ZJIE3VMQBWNALLQ5E2DTOC46VANCNFSM4IHTWPNA>
.
|
It creates such links and scrolls to them. There seems to be a change in Firefox 80, though, that broke the scrolling. We're tracking this as GoogleChromeLabs/text-fragments-polyfill#60. |
Oh neat, Thanks for the clarification and the link to the official
extension!
…On Mon, 17 May 2021 at 00:22, Thomas Steiner ***@***.***> wrote:
It creates such links and scrolls to them. There seems to be a change in
Firefox 80, though, that broke the scrolling. We're tracking this as
GoogleChromeLabs/text-fragments-polyfill#60
<GoogleChromeLabs/text-fragments-polyfill#60>.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#194 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABQ5ZJIVUFPTB5UYCANW7Z3TOC74XANCNFSM4IHTWPNA>
.
|
My concern with the scroll-to-text-fragment spec as written is that there is no ending delimiter defined for fragment directives. This is a problem for composability with other schemes. Please see: WICG/scroll-to-text-fragment#193 (comment) Another significant concern with the the spec as written is that Chrome breaks the existing behavior of |
The inability to get the full URL via script is intentional - the performance API workaround is something of a bug that I'm hoping we can fix at some point. There's definitely use cases where having the full URL would be useful but there's also cases where a page shouldn't be able to access that information. My hope was we could balance these by providing an API - curious if you've seen or have thoughts on: https://github.com/WICG/scroll-to-text-fragment/blob/main/fragment-directive-api.md |
I wanted to write a little more about the "I must be last" rule and point out concerns: The "I must be last" rule is undesirable, and from my understanding of the spec, unneeded. More permissive, interoperable, and composable behavior is preferred. I think a fix would be simple and straightforward. Problems with the "I must be last" rule:
The reason why fragment's ending delimiter is the end of the URL is because the fragment has different behavior from the rest of the URL in that it isn't sent to the server. A URL is split into two parts: (sent to the server | not sent to the server), and this major behavioral break is deserving of such a rule. Fragment directives live in this existing fragment paradigm, there's no need to promote fragment directive behavior over fragment's exiting behavior. Concerning point 0 from the list above, it would be better, still not ideal, if the "I must be last" rule was scoped to fragment instead of being scoped to URL. The easiest way to be permissively composable with existing fragment schemes and future URL components is to 1. specify an ending delimiter or alternatively 2. the spec should be update to state that "the the end of the fragment directive is the end of the fragment" (not end of the URL), and thereby inherit the existing, and standard behavior of fragment. As said previously, URL component is the correct place for that rule, not a scheme inside of a URL component. For example, a hypothetical new URL component after fragment would require a spec change where fragment would need an ending delimiter (which would likely be the start of the new component). If fragment directive is not scoped to fragment and is instead scoped to URL, as it stands now, the new hypothetical component to the URL spec would not need to fix both fragment and fragment directive. |
@bokand regarding I wouldn't advocate for it, but if there's new behavior needed for fragment directive, fragment directive needs to be promoted to the level of URL component, not a scheme inside of URL fragment. I admire the desire for backward compatibility, but fragment's behavior should not be adjusted. Removing fragment directive from fragment on these API calls redefines fragment. I think the option best option here is to leave |
I wanted to share a real world example of where these problems are relevant. This link (or something like it) should work, but doesn't as the spec is written: Only this link works: We're asking fragment directives to play well with others. |
Today we ran into another issue. There is no way to get the URL if the protocol is
This means:
Edit: I'm assuming the only way to get the URL is via the proposed API that's already enabled by default since on version 104.0.5112.79 and there's no such thing. From that API document, Is there a way to get this to work? As a different matter, Github appears to have some sort of conflict with fragment directives Going to this URL: Strips out the fragment. I'm assuming they're doing some sort of sanitization. |
@zamicol I've responded on https://github.com/WICG/scroll-to-text-fragment since I think that's a more appropriate venue for these issues |
fwiw, this now works in both Safari and Chrome (and, naturally, Edge). caniuse.com link |
WICG/scroll-to-text-fragment#196 relates to this. |
I really hope Firefox gets this because it's genuinely a useful feature/functionality. I'm sure there's ways of solving any concerns. It really is a great feature that saves time. |
This comment was marked as off-topic.
This comment was marked as off-topic.
@RokeJulianLockhart, this add-on is broken, as mentioned in the comments on the page you linked. I opened an issue for this, but I do not have high hopes, I don't think it's maintained anymore. Unfortunately I have zero experience in writing add-ons. |
I found another extension, https://addons.mozilla.org/en-US/firefox/addon/text-fragment/, that works really well (supports copying links from selected text and jumping to text from a url with a text fragment) It even works on Firefox for Android! |
This comment was marked as off-topic.
This comment was marked as off-topic.
This is not the right place to discuss Firefox extensions. Thanks. |
This comment was marked as resolved.
This comment was marked as resolved.
Mozilla's position was updated in #611 (#194 (comment)). |
Request for Mozilla Position on an Emerging Web Specification
Other information
w3ctag/design-reviews#392
The text was updated successfully, but these errors were encountered: