-
Notifications
You must be signed in to change notification settings - Fork 708
[css-ui-3] auto cursor should behaves as default cursor except for text? #1598
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
Comments
No, that is not the goal of the spec. The cursor is expected to change (hand over link, I-beam over input area…), but it is expected to do that using the UA stylesheet, not using the When we looked at standardizing exactly what the auto value does, we decided using As some elements contain text AND empty areas, and it is not possible to use selectors to tell these appart, I think it would be fair to add a note to the specification to clarify that expectation, but I do not think any behavior change is needed. However, if you find situations where you want to change the cursor but cannot do it in the UA stylesheet, please let us know. That would absolutely be something to consider for an addition to the specification. |
|
The key word is "specifically". The second part is an explanation of how to do the first one, which means the UA is not allowed to change the cursor based on context in any way it wants, but only in one way. It would be better to phrase it this way:
No. when a user sets |
I test the "cursor:auto" behavior with this page: http://output.jsbin.com/yixetov (In Mozilla's page: https://developer.mozilla.org/en/docs/Web/CSS/cursor, they use "E.g." instead of "specifically". ) Also, when there is text inside textarea, one html element will have two types of cursor. It seems weird. |
That's a mistake.
div/p/article… elements have two types of cursors for 1 element: text over text, default over empty areas. That is what auto is for. Everybody has been doing that forever, so I do not think that this is weird. For textarea (and a number of similar form controls), the behavior would be the same if cursor is left to its auto value, but adding The specification currently does not propose additions to the UA stylesheet, and leaves it up to browsers to do what they want. Maybe css-ui-4 should make an attempt at giving a UA stylesheet for HTML for cursors over various elements, but for now the expectation is that browsers will do it by themselves. |
Sorry, I replied too fast. The firefox behavior over the link is the desired one. Over the text area it is not (all browsers are incorrect according to the specification). |
@RByers @tabatkins Do we want to match this "cursor: auto" behavior? Could you think of any possible problem for implementing this? |
For what it's worth, the places where Gecko (excluding XUL) has cursor behavior that's not in the UA style sheet cover:
|
@dbaron :
This is per spec.
This is also per spec, as a “may”. (see https://drafts.csswg.org/css-ui-3/#valdef-cursor-text)
Is there any reason why this could not be moved to the UA stylesheet?
This is per spec, based on this statement: "User agents may ignore the cursor property over native user-agent controls such as scrollbars, resizers, or other native UI widgets e.g. those that may be used inside some user agent specific implementations of form elements."
This is Netscape Plugins, right? These things are on their way out, can we just ignore it and assume it is going to disappear before too long?
As far as I can tell, this could be done via the UA stylesheet, couldn't it? |
@RByers @tabatkins @EiraGe https://lists.w3.org/Archives/Public/www-style/2014Nov/0531.html |
> `<input type=image>` treats auto as pointer (not sure why!)
Is there any reason why this could not be moved to the UA stylesheet?
I suspect not. But first I'd look into seeing whether other UAs match it.
> image maps (see #1618)
As far as I can tell, this could be done via the UA stylesheet, couldn't it?
Not really. It requires code to say that for images, if the pointer is in the area covered by an area element, use the computed cursor of the `area` rather than of the `img`. (`area`s themselves can't really be event targets since they can be referenced from multiple `img`s.) But otherwise it's doing what the relevant specs (CSS + HTML) say.
|
But that's not specific to the |
Sorry for the delay. Yes we should try to match the spec (and if we hit any significant web compat problems those are potential spec issues). To the extent we're just matching Firefox the web compat risk is low and you can probably just treat such changes as a bug-fix (but let me know if we get any bugs about broken sites). If you find that you're doing something which no other browser appears to do today though then we might need to be more cautious. |
There's a bit of both. Firefox does more cursor changes than chrome via the UA style sheet, so some changes (like the pointer cursor over links) will be just matching Firefox. But Firefox still has some more magic built into the auto value than the spec calls for, so there we are in slightly more uncharted territory. If we compat requires some aspect of cursor changing to be handled via |
The CSS Working Group just discussed
The full IRC log of that discussion<eae> Topic: [CSS-UI-3]<Florian> https://test.csswg.org/harness/results/css-ui-3_dev/grouped/filter/ <Florian> https://test.csswg.org/harness/results/css-ui-3_dev/grouped/filter/17/ <eae> Florian: Link to test suite results <fantasai> astearns, Rossen, values and units is blocked on https://github.com//issues/434#issuecomment-310183908 <eae> Florian: Normative requierments that do not have two or more implementations <eae> Florian: Think covergae is sufficient. One test per normative assertion. Only 6 are missing for MUST. More are missing for SHOULDs. <eae> Florian: We're getting there. Since it is six and not zero I'm not pushing for CR today. Please fix them so that we can go to PR. <eae> Florian: One of the things I have not verified coverage for is direcitonal navigaiton properties. Implemented in presto and TD <eae> Florian: There are some informal issues raised. Marked at risk. <eae> Florian: Specifically, one thing we have already resolved on that has been quesiton is whether we should stick to what we have resolved on with regards to cursor. <eae> Florian: All the changes to cursor auto should be UA stylesheet. Have filed bugs to blink about this, they filed bug back with "are you sure?". <eae> fremy: In edge, there are some cases where we have things in the UA stylesheet. Also things that are magic. Much better to use UA stylesheet, fies bugs. <eae> fremy: If you want to change, it should be in the UA stylesheet, <tantek> re: https://test.csswg.org/harness/results/css-ui-3_dev/grouped/filter/ I would be strongly concerned with any test that fails in blink, edge, gecko, *and* webkit <tantek> q? <Florian> https://github.com//issues/1598 <eae> Florian: If you find cases where it cannot be in the UA stylehseet and it isn't a known one then please file a bug back. <eae> Florian: Can we close this bug (1598) as no change? <eae> Rossen: Any objecitons? <eae> RESOLVED: Close 1598 as no change. <tantek> q? <TabAtkins> GitHub: https://github.com//issues/1598 <Rossen> q? <Florian> https://github.com//issues/1637 <Florian> github: https://github.com//issues/1637 <TabAtkins> GitHub: https://github.com//issues/1598 |
Hey @frivoal, I was prototyping a change in Edge that would make us match the spec, but I found out I disagree with the test you wrote; when this issue was resolved I read the following reply to @dbaron's questions and thought that if this was correct I agreed with your proposed spec text, but this does not seem to be properly reflected in the spec.
Here is what the spec currently says:
Here is what I think the spec should say:
Changing the spec in such a way makes all browser pass the test, but the test stops being exhaustive enough to cover all cases. I wrote a new test covering more cases as part of my change, and it shows that currently only Firefox passes the test (and my prototype in Edge).
|
@FremyCompany you're right, I was a bit quick replying to @dbaron, and missed the "and anything editable". My understanding was that switching to a text cursor over "anything editable" was doable in the UA stylesheet ( At the same time, since we have more interop on As for your test, it looks correct, but I'd split it in 4 (2x2) tests:
|
I am not entirely sure everything can be expressed as css selectors. Consider Of course, the only reason it is possible to implement is because we let "auto" fallback to a value computed at hit-testing time (the "magic" part, which in Edge is a boolean called the WantArrowCursor flag: true if I do agree with you on the link-in-contenteditable case though: we can and should use I would just prefer a tweak in the wording that would help us describe how the logic for disambiguating
I agree we might want to split this into multiple tests, I just tried to do a quick edit of yours for my own testing purposes. Unfortunately there is no interop on whether disabled text fields allow selection of text (they do in chrome so they show the text-beam cursor, while firefox and edge do not allow to focus a disabled field and therefore do not allow selection of its content so we both display an arrow-pointer; I think all browsers agree that a readonly input shows a text-beam cursor though because its content is selectable even if not editable). To me, this divergence would be allowed per-spec with the edit I propose because the difference in cursor is also tied to a difference in functionality which is what I am not sure it would be right to enforce a particular value in the test, in the end it depends on what the operating system considers editable and selectable, which might vary per platform. |
Agreed, and CSS-UI level 4 calls that out explicitly. But
I am not sure I've followed you 100%. I do understand (and agree with) the part about selectability, but I thought you were saying that editability could be handled via the UA stylesheet. Or is that only contentEditable? What other kind of editability cannot be handled in the UA stylesheet? |
Agreed with changing "over text" to "over selectable text". |
Not entirely sure if such thing exists or not; maybe that second part isn't actually required, but I am afraid there are people currently using Also, since what is considered editable might vary per platform (for example, an input type="color" might be a textbox in some browser, hence editable, and a button in another, hence not editable): what value should authors use if they want to specify a custom cursor on that element with a fallback cursor? I would argue they should specify "auto" as fallback and let the browser decide whether the control is editable/selectable and display the default/text cursor depending on that, and not hardcode a value that works for their specific browser/platform and looks weird on others). |
Another interesting case I found while investigating the WantArrowCursor flag is that we do not show a text-beam cursor on already-selected text but the default arrow instead (presumably to indicate the user can right-click to open the context menu). I would rather have this behavior stay per-spec. |
I suppose they could do However, the argument that we already have interoperability on auto looking like text over editable things is for me a convincing argument. If other browsers agree and want to preserve that, I'm ok with a spec edit.
I am not sure who to cover that one. I think it could be considered allowed under this part of the spec:
but that feels a bit like a stretch. Any suggestion? |
Actually, this sounds good enough to me. |
I'd like the spec to say that the auto-cursor for links is the hand 'pointer'. That's more intuitive? Chrome 62, Safari 10 and Edge 15 show the hand as the auto-cursor for links already. I suggest: "auto behaves as text over selectable text and as pointer over links" |
We resolved against doing that (twice already), because
So the cursor should look like the hand Cases that cannot be done through the UA stylesheet are what |
Thanks for the feedback! Argument I. Ask an intermediate web developer (or a web user): "What do you think is the automatic cursor when hovering links?" Most will probably answer "Ah, easy, it is the hand pointer!". I would like the spec's 'auto' to reflect this common conception of links. All browsers (except Firefox) have had this behavior so I'd like the spec+Firefox to adapt here (not all others).
Argument II. I think links can be added to the list tough (it will not be a never ending task).
Argument III. It can also be done using the 'auto' value. I would like to keep the UA stylesheet compact. (I think our current UA stylesheets already have too many exceptions. These long UA stylesheets confuse web developers). Argument IV. Open cursor-auto-002 in Firefox. Isn't it confusing that an I-beam is shown? Displaying an I-beam gives users a hint about semantics: "this point can start a selection". But it cannot! Links cannot start selections (because they are draggables) so an I-beam might confuse regular users. That's why I think cursor-auto-002's expectation needs to change. |
@hugoholgersson Unfortunately, what you think is a behavior that is interoperable between Webkit-derived browsers and IE/Edge is in fact not as interoperable as you would believe. The code we have to support for overriding https://wptest.center/#/yizue0 (Edge display a text-beam cursor on 22, Chrome a hand-pointer). Right now At this point the question is whether there is a sane-enough behavior that we all can implement that would get us rid of a bunch of terrible code (and then developers would have a predictable experience when using cursor, all browsers would react the same, and we make things better for our users) or we find out there is not and we stay different for a while longer. We previously resolved we wanted to be interoperable and resolved on a particular solution, but it turns out the text of the spec did not state exactly what the discussion had us think it was, but except if we cannot get consensus on the updated text, I would rather not have us revert the previous decision. Outside this real-implementer-life considerations, I have no idea why someone would manually set On the other side, if as an author you ever wondered what cursor was being displayed on an element, you had absolutely no way of finding out. With the proposed text (and what Firefox implements) the computed style of an element will always return the value of the cursor that is being displayed, and not "auto" for every single element. Even when you get "auto", you know as an author this is not any random cursor but one of two specific ones. This, I think, is very valuable for authors. |
The Working Group just discussed
The full IRC log of that discussion<dael> Topic: auto cursor should behaves as default cursor except for text?<dael> github: https://github.com//issues/1598 <dael> florian: We've already narrowed problem considerably. It's only about distinguishing things we can't in UA stylesheet. There's two things reopened. WE say one cursor over test, one over everything else. Wee should change that to be one over selectable text. That was in originally, seemed an unintentional omissions <dael> fremy: I can give some background as to why this is useful. I fyou have text inside a buttonn you don't want the cursor to become a text cursor, but you don't want that. To me it seems straight forward and most browsers are doing this. I think that should be in the spec. <dael> florian: I sort of have this in L4. In L4 I put an exception to not look like text cursor. I forgot the other things that imght make the text not selectable. [missed] <dael> Rossen: What is the request? <dael> florian: For a resolution to change the definition of the auto cursor to change on selectable text, not all text. I'll make edits. <tantek> and I already +1 that here: https://github.com//issues/1598#issuecomment-335863545 <tantek> last week <dael> Rossen: That would mean change of behavior...fremy your example. what would the change mean to you? <dael> fremy: We are already doinng this in edge. I think all browsers also. <dael> fremy: This is aligning spec with browsers. <dael> dbaron: Were you going to get to the editable thing? <dael> florian: I wanted that sep. <dael> florian: proposed resolution: Change the definition of cursor auto to look like text over selectable text <tantek> +1 https://github.com//issues/1598#issuecomment-335863545 <dael> Rossen: Objections? <dael> RESOLVED: Change the definition of cursor auto to look like text over selectable text in css UI 3 <dael> florian: Second part is another thing where we may want to align to browseres, but it contridicts previous intention. In the general case browsers change to text cursor over editable, even if it's not next. This is doable in UA stylesheet, but we're interop in not doing that. There's reluctance to change, esp. on Chrome side. Do we want to change or grant an exception for this because we are interop? <dael> Rossen: Opinions? Esp from Chrome? <dael> robertknight_clo_: Do we have anyone from Chrome? <dael> s/robertknight_clo_/rossen <dael> Rossen: I guess there's no one from chrome <dael> florian: Chrome seemed if other browsers commit to change and we push hard they'll do it. They prob don't want to be alone in this. I'd like to hear from Mozilla. <dael> dbaron: I'm fine with having editable thing in spec. It's not 100% clear to me that read/write pseudo does the right thing here. <dael> dbaron: I jut haven't thought through it. I'm okay with the editable exception. <florian> tantek: test case: https://test.csswg.org/harness/test/css-ui-3_dev/single/cursor-auto-005/format/html5/ <tantek> +1 similar thoughts to dbaron <tantek> thanks florian <dael> fremy: I'm in favor too. It's interop i n all browsers. We can change, but I don't think we need to. I don't think author would expect it and changing something interop could cause problems. My opinion is we should make the change to make things easier for impl. <dael> Rossen: I hear a lot in favor or don't mind. <dael> Rossen: Objections to adding an exception into L3 UI? <tantek> so we're saying auto should look like text over editable text? <tantek> just trying to understand <florian> tantek: yes <dael> RESOLVED: Add exception for editable text into L3 UI <florian> should -> must <tantek> +1 |
This adjust and completes the test suite, reflecting the changes resolved in w3c/csswg-drafts#1598 (comment)
This adjusts and completes the test suite, reflecting the changes resolved in w3c/csswg-drafts#1598 (comment)
This adjusts and completes the test suite, reflecting the changes resolved in w3c/csswg-drafts#1598 (comment)
Relevant tests needing review here: web-platform-tests/wpt#7894 |
The publicize disconnect buttons on the Sharing page currently have a cursor css property with a value auto applied, which probably wasn't intended. When properly implemented by the browser vendor (like in a release version of Firefox or Chrome 63+), cursor: auto on a text link must display the so called text selection cursor according to the CSS specification. Additional reading (incl. comments by some browser vendors): w3c/csswg-drafts#1598 Official CSS test: https://test.csswg.org/harness/test/css-ui-3_dev/single/cursor-auto-002/format/html5/
#8956) The publicize disconnect buttons on the Sharing page currently have a cursor css property with a value auto applied, which probably wasn't intended. When properly implemented by the browser vendor (like in a release version of Firefox or Chrome 63+), cursor: auto on a text link must display the so called text selection cursor according to the CSS specification. Additional reading (incl. comments by some browser vendors): w3c/csswg-drafts#1598 Official CSS test: https://test.csswg.org/harness/test/css-ui-3_dev/single/cursor-auto-002/format/html5/
The spec of "auto" behavior says:
and
According to the css tests cursor-auto-005 and cursor-auto-002 the auto cursor shouldn't change when it's over a text input area or a link. Two chromium bugs were filed by @frivoal :
bug 1 and bug 2.
I think the the cursor should shows "it's a clickable link" when over a link and I-beam for the input area when it is "auto", because it should change based on the current context. Is the spec wants cursor doesn't show it's over link and over input area?
Also, "auto" is the initial value for cursor style: https://drafts.csswg.org/css-ui-3/#cursor. In Chrome, "auto" behave same as cursor style not set. But in Firefox, set "cursor: auto" cursor over link is different from not setting cursor style.
Should "auto" behave same as style not set?
The text was updated successfully, but these errors were encountered: