Closed Bug 88688 Opened 23 years ago Closed 21 years ago

(invalid) 'cursor: auto' shows text cursor for links

Categories

(Core :: DOM: UI Events & Focus Handling, defect, P3)

defect

Tracking

()

VERIFIED INVALID
Future

People

(Reporter: con, Assigned: dbaron)

References

(Blocks 1 open bug, )

Details

Attachments

(2 files, 1 obsolete file)

On the domain web site listed, the hyperlinks make the cursor change to the text
editor cursor instead of the hand hyperlink cursor. This happens on most links
on this web site. Browsing still works as normal, but it is not clear when you
are over a hyperlink.
I see this on Win32 also, marking all.

The reason that mozilla is showing an I-bar cursor for all the links on this
page is because the stylesheet sets cursor:auto for all hyperlinks.  IE/NN4
display the hand icon.  I have no idea which is correct per spec, but the hand
would seems correct.

Attaching a reduced testcase.
Status: UNCONFIRMED → NEW
Ever confirmed: true
OS: Linux → All
Attached file Reduced Test Case
See bug 30971

Looks like it caused this problem.  Marc Attinasi even deduced this bug when he
s=mattinasi, but I guess no one tested this case.
This is definitely related to bug 30971, which was suppossed to make cursor:auto
work for everything but failed to make this case work. Could be dup'd to bug
30971 I think (I'm reopening bug 30971 now).
I think its a dupe of 30971 but I'll let pierre make that call.
Assignee: joki → pierre
Found another site that exhibits this:
http://www.sea.vic.gov.au/renewable/SHW/rebate/index.html
Ok, now I'm not sure if this is the same bug but this time instead of a text
cursor, it changes to a bidirectional arrow over the menus on either side of the
main body of text and on the "go" buttons on this site:
http://www.itnews.com.au/
Linux build id 2001072621

I'm going to attach a patch which is based on what we do in 
nsFrame::HandlePress().

Marc/DBaron: please review.  Would you prefer that code to be put into a new 
nsIFrame method that detects whether the current frame is inside an anchor?
Status: NEW → ASSIGNED
Depends on: 30971
Target Milestone: --- → mozilla0.9.5
Attached patch patch 1.0 (obsolete) — Splinter Review
How is this different from marking the "cursor: pointer" rule in html.css as
!important, and why do we want to fix this bug rather than WONTFIX it?
If you set the cursor as !important in html.css, nobody will be able to change 
it, not even authors (UA-!important is as good as code and it always applies).  

The attached patch sets the cursor of a text frame only if the computed value of 
the cursor is still 'auto'.  If the frame is within an anchor with href, 'auto' 
is interpreted as 'pointer', otherwise it is interpreted as 'text'.

We want to fix it so that "cursor:auto" works correctly over both standard text 
and hyperlinks.
It still mostly defeats the point of having 'cursor: pointer' in html.css.  See
http://lists.w3.org/Archives/Member/w3c-css-wg/2001JulSep/0388.html
|cursor:auto| doesn't mean "use the cursor that is defined for this element in 
html.css", it means "do the right thing if nothing else is specified".

- It doesn't defeat the point of having 'cursor: pointer' in html.css: it just 
means that the declarations in html.css are often redundant with what is already 
defined in C++.  The benefit for us of leaving the declarations in html.css is a 
greater flexibility if one day we decide to change the default cursors.  It also 
shows the user what to do if they want to override the declaration in a user 
stylesheet.

- |cursor:auto| also allows the cursor to switch automatically between values 
within the same element.  The typical case is 'text' and 'default' inside 
elements that contain some text, but it could also be the case inside complex 
form controls.  This behavior cannot usually be represented in a stylesheet 
(unless if the different zones of the element are selectable as pseudo-elements).

All in all, I see an interest in making |cursor:auto| work correctly.

Reviews please?
Whiteboard: [fix in hand]
Summary: Hyperlinks appearing as text on mouseover → [review]Hyperlinks appearing as text on mouseover
Shouldn't this:

+      nsIContent* parent;
+      content->GetParent(parent);
+      content = dont_AddRef(parent);

be something like:

Pierre, this is strange:
+      content->GetParent(getter_AddRefs(content));

No, since the evaluation of the |this| for the GetParent call and the
constructor of the getter_AddRefs happen in an undefined order, and the latter
will happen first on Windows, causing a guaranteed null-dereference.
OK, We do hat all the times with frames, but that is a different story.
r=attinasi on patch 1.0
I still think this patch is wrong and I'd like to see this discussed in the
working group before we take this.  (The spec is *very* vague.)
Whiteboard: [fix in hand] → [fix in hand] WG
You already brought it up to the WG but nobody replied, maybe because they were 
like me a bit puzzled by the non-issues you described.  Could you rephrase why in 
your opinion the spec is vague and why this patch creates more problems than it 
fixes?  I don't get it. :-(
Under the interpretation of 'cursor: auto' that you're supporting, this patch is
seriously incomplete -- it doesn't cover any of the form controls or other
things that have non-default cursors.  Following your approach correctly
requires a lot more code -- code that I'm sure will eventually be written and
bloat mozilla if we go down this path.  Under my interpretation, the 'cursor'
property is actually useful in UA stylesheets since we're not required to put
whatever is in the UA stylesheet into C++ code that interprets 'auto'.  I don't
see how an interpretation halfway between the two makes any sense, and I'd
prefer my interpretation to yours because it is vastly simpler.
My interpretation is the following... The C++ code should set the cursor to 
'text' when the mouse is over some text, 'pointer' when the mouse is over a link, 
and 'default' everywhere else.  At any point, the cursor can be set through a 
style declaration, in ua.css or elsewhere.  That's what we currently have in 
Layout (look for the implementations of GetCursor()).  It doesn't seem very 
complex to me, nor likely to introduce some bloat.

What is your interpretation?
DBaron: you proposed to mark this bug WontFix or to evangelize the offending site 
but...
1) We have more than one site showing the problem (the reporter listed three and 
I remember having seen this behavior on other sites).
2) Other browsers (Nav4 / IE) do the right thing and display the cursor as 
'pointer'.

Could someone please review?
Comment on attachment 49870 [details] [diff] [review]
patch 1.0

reviewed on 2001-09-28 11:50

BTW: is there a perceptible performance hit with this? It looks like a bit of work to figure out the inAnchor value...
Attachment #49870 - Flags: review+
No performance hit: it's only executed on mouse-move events over text frames.

waterson/jst: please review
This looks like a performance problem waiting to happen, the DOM tree you're
traversing could be *really* deep, how often is this code called? If this is
called every time the mouse cursor moves in a text frame, then we'll end up
calling this code a *lot*, and every call could potentially end up walking a
child-parent chain thousands of elements deep in edge cases (yes, there are such
edge cases out there).

The attached patch also only fixes this problem for HTML links, don't we have
the same problem with XLink links? I'm not all that excited about this patch, is
there a better alternative?
jst: The patch merely does what we already do for nsFrame::HandlePress().  Do you 
think we should walk the frame tree instead of the content tree?  At least we 
would be limited by MAX_REFLOW_DEPTH.  I don't know about XLinks.  Can you write 
a testcase, or should I reassign to somebody else?
Target Milestone: mozilla0.9.5 → mozilla0.9.6
I had to add support for SimpleXLinks in the Selector matching for :link way bak
when.  See
http://lxr.mozilla.org/seamonkey/source/content/shared/src/nsStyleUtil.cpp#679
for a clue on how to detect SimpleXLinks (note: it is expensive - we really need
a higher level link manager so we do not have to trundle through the content or
frame model to find out if something is a link - that was Hixie's idea.)
Oh yea, please do not take my little minor, almost insignificant comment as an
indication that this bug should come to me :-D I have enough of my own - really.
Here is an updated patch:
- XLinks are checked.
- It walks the frame tree.

attinasi/jst: please review.
Priority: -- → P3
Attached patch patch 1.1Splinter Review
I still don't think this should be checked in.  It will force all other browsers
to follow this silly behavior rather than putting it in the UA stylesheet (since
it would mean that both we and IE do it, and prevent any sensible solution from
happening in the future).

> 2) Other browsers (Nav4 / IE) do the right thing and display the cursor as 
> 'pointer'.

Do you seriously think Nav4 supported the 'cursor' property?
|cursor:auto| is legit over links, there are pages out there doing it and you can 
even see it in some tutorials on the web [1] including from Microsoft.  The point 
is: Mozilla is the only browser that displays an i-beam cursor over these links.  
I don't think that we can close this bug as WONTFIX as you proposed and we 
certainly don't want to fix it with a UA-!important declaration.  It would be 
better if we had the higher level link manager mentioned above but it's not a 
reason to hold off fixing bugs.

[1] http://www.htmlgoodies.com/beyond/css_cursors.html
    http://www.see-search.com/webdesign/setcursor1.htm
    http://msdn.microsoft.com/library/en-us/dnwbld/html/mit9951.asp
I have no opinion on whether this is good for the web or not - sorry, I'll leave
that to you guys. As for the code, it looks fine. If you decide to commit this
after considering David's arguments, sr=attinasi
It's not the time to checkin trivial things like this.  We'll reconsider later.
Summary: [review]Hyperlinks appearing as text on mouseover → [ready]Hyperlinks appearing as text on mouseover
Target Milestone: mozilla0.9.6 → mozilla1.0
*** Bug 111870 has been marked as a duplicate of this bug. ***
Keywords: mozilla1.0
Moving to mozilla1.1. Engineers are overloaded!
Target Milestone: mozilla1.0 → mozilla1.1
*** Bug 126590 has been marked as a duplicate of this bug. ***
Bulk moving from Moz1.1 to future-P1. I will pull from this list when scheduling
work post Mozilla1.0.
Priority: P3 → P1
Target Milestone: mozilla1.1 → Future
QA Contact: madhur → rakeshmishra
Attachment #49870 - Attachment is obsolete: true
*** Bug 152534 has been marked as a duplicate of this bug. ***
Assigning pierre's remaining Style System-related bugs to myself.
Assignee: pierre → dbaron
Status: ASSIGNED → NEW
Priority: P1 → P3
Summary: [ready]Hyperlinks appearing as text on mouseover → [ready]'cursor: auto' shows text cursor for links
*** Bug 160456 has been marked as a duplicate of this bug. ***
*** Bug 168140 has been marked as a duplicate of this bug. ***
QA Contact: rakeshmishra → trix
Any updates on this? (it's been at least 1 year since anything was changed) 
This also causes a problem for afr.com (Australian Financial Review) which has
made the CFO of my company think that the site just doesn't work in Mozilla. 
I'm happy to argue that the problem occurs because the code is non standards
compliant - if that is the case,  but it just seems to be in limbo at the moment
(and has been for some time) as to whether it will be fixed or if it's a won't fix.

Is there a workaround for this?  I'm not too sure about the ua.css html.css
area, but if there is something I could add/change that would make things work
better, then that'd be good - but it seemed that there was some argument for and
some against this also (and I didn't quite follow the details of what it might
break by changing things, and I've never fiddled in this area, so I'm not really
sure what I'm doing in the first place).

Any sort of update would be good. 
I think our current behavior is correct.
*** Bug 226421 has been marked as a duplicate of this bug. ***
*** Bug 230369 has been marked as a duplicate of this bug. ***
Is still think this should be WONTFIX.
->invalid
Status: NEW → RESOLVED
Closed: 21 years ago
Resolution: --- → INVALID
*** Bug 253796 has been marked as a duplicate of this bug. ***
*** Bug 257495 has been marked as a duplicate of this bug. ***
Anyone care to explain what should tech evangelists suggest to websites that
have this problem?

Prog.
Those websites should add the following to their CSS file:

# a:link,a:visited{
#  cursor:pointer;
# }
Status: RESOLVED → VERIFIED
Hardware: PC → All
Thanks Anne, do you have any suggestions for pages that script links using
onclick? This is another case where Mozilla displays an I-shaped cursor instead
of a hand-shaped one. See Bug 198349 for more details.

Prog.
They could have something like:

# *[onclick]{
#  cursor:pointer;
# }

The attribute selector won't work in Internet Explorer, but it will give the
intended effect in Mozilla.
*** Bug 271384 has been marked as a duplicate of this bug. ***
*** Bug 299301 has been marked as a duplicate of this bug. ***
Summary: [ready]'cursor: auto' shows text cursor for links → (invalid) 'cursor: auto' shows text cursor for links
Whiteboard: [fix in hand] WG
Blocks: 847320
Component: Event Handling → User events and focus handling
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: