Closed Bug 214373 Opened 21 years ago Closed 20 years ago

enter does not work on image maps

Categories

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

defect
Not set
major

Tracking

()

RESOLVED FIXED

People

(Reporter: rivdsl, Assigned: bryner)

References

(Blocks 1 open bug, )

Details

(Keywords: access, regression)

Attachments

(1 file, 1 obsolete file)

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.5a) Gecko/20030728 Mozilla Firebird/0.6.1
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.5a) Gecko/20030728 Mozilla Firebird/0.6.1

When you tab trough an image map, pressing enter or ctrl+enter when the focus
ring is around one of the areas doesn't do anything. I think it should open the
associated URL, because when you press shift+F10 and choose 'open link in new
tab' it will open the URL.

Reproducible: Always

Steps to Reproduce:
1.goto http://members.chello.nl/j.vandersluijs/moztest/
2.press tab a few times until the focus ring is around one of the buttons
3.press enter

Actual Results:  
nothing happens

Expected Results:  
Open the correct link in the same window
Confirming; I thought this used to work...
Status: UNCONFIRMED → NEW
Ever confirmed: true
OS: Windows XP → All
Hardware: PC → All
Man, when did this break?
Blocks: focusnav, atfmeta
Severity: minor → major
Keywords: access, sec508
Not sure if this is related but clicking on the image here titled "download"
which is an image map doesn't work when clicked on with the mouse.

http://www.myob.com/us/downloads/downloads/mac_applescripts.htm
*** Bug 228275 has been marked as a duplicate of this bug. ***
Made the title more searchable. Is this happening because AREA isn't really a
link, like A and LINK?
Summary: Enter or ctrl+enter does not work on imagemaps → enter does not work on image maps
This is a regression from bug 124789.  The basic problem is that
nsPresShell::HandleEvent no longer sets mCurrentEventContent from the ESM.  It
just sets mCurrentEventFrame and then later gets the content from the frame.

Problem is, for <area> elements the event frame is the imageframe but the event
content needs to be the <area> content.  This works for click events because of
the hack in nsImageFrame::GetContentForEvent, but key events end up getting
delivered to the <img> node instead of the <area> node in this testcase....

If I just add a call to GetFocusedContent (setting mCurrentEventContent) at the
same place in nsPresShell::HandleEvent that calls GetFocusedFrame, key events on
<area> start working again....
Assignee: aaronlev5 → bryner
Keywords: regression
*** Bug 232995 has been marked as a duplicate of this bug. ***
Attached patch patch (obsolete) — Splinter Review
This does what boris described.  This seems like the right fix... the problem
just didn't affect tabbing since PostHandleEvent works off of the frame, not
the content.

(The other way we could do this is to make nsImageFrame::GetContentForEvent
return the focused area for key events.  That seems unnecessary though.)
Attached patch better patchSplinter Review
don't mess up the refcounting...
Attachment #144155 - Attachment is obsolete: true
Comment on attachment 144157 [details] [diff] [review]
better patch

Here's a little background info that might be helpful for reviewing:

When focus is in an image map, the ESM keeps the focused frame (used for
Pre/PostHandleEvent) set to the image frame and sets the focused content to the
area element.  We need to make sure mCurrentEventContent is set to the ESM's
mCurrentFocus, or we will end up calling nsImageFrame::GetContentForEvent() and
it does not know to return the focused area for key events.  (For non-imagemap
elements, the focused frame will simply return mContent when GetContentForEvent
is called).
Attachment #144157 - Flags: superreview?(jst)
Attachment #144157 - Flags: review?(jst)
Comment on attachment 144157 [details] [diff] [review]
better patch

r+sr=jst
Attachment #144157 - Flags: superreview?(jst)
Attachment #144157 - Flags: superreview+
Attachment #144157 - Flags: review?(jst)
Attachment #144157 - Flags: review+
Comment on attachment 144157 [details] [diff] [review]
better patch

requesting approval for 1.7 final
Attachment #144157 - Flags: approval1.7?
Comment on attachment 144157 [details] [diff] [review]
better patch

a=asa (on behalf of drivers) for checkin to 1.7
Attachment #144157 - Flags: approval1.7? → approval1.7+
checked in.
Status: NEW → RESOLVED
Closed: 20 years ago
Resolution: --- → FIXED
(In reply to comment #15)
> We suspect this caused regression:
> 
> https://bugzilla.mozilla.org/show_bug.cgi?id=307172

I can confirm that. And it's an issue in 1.7.x, branch and trunk.
Component: Keyboard: Navigation → User events and focus handling
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: