Closed Bug 159998 Opened 23 years ago Closed 22 years ago

typing named anchor into address bar makes address bar appear to keep focus

Categories

(Core :: DOM: Navigation, defect)

x86
Windows 2000
defect
Not set
minor

Tracking

()

RESOLVED FIXED

People

(Reporter: jruderman, Assigned: aaronlev)

References

(Blocks 2 open bugs)

Details

Attachments

(1 file, 1 obsolete file)

Steps to reproduce: 1. Type http://www.squarefree.com/bookmarklets/pagelinks.html#search_links into the address bar. 2. Press enter and wait for the page to load. 3. Select the address. 4. Press enter again. Result: the page scrolls to the anchor again, but the location bar *appears* not to lose focus. The selection is still dark blue, but hitting tab goes to the first item after the named anchor and Ctrl+C doesn't copy. If you replace step 3 with "place the caret after the address", a similar bug occurs: the address bar still has a blinking insertion point but no longer has focus. This bug happens in 1.0 and 2002 072908 (~1.1b) but not in 0.9.9. This bug may have been caused by the fix for bug 130447, "Clicking on anchor goes to top of page, entering the URL directly doesn't".
Blocks: 55416, focusblink
I am not sure this bug belongs to me. I think its better if Aaron first took a look at this.
Assignee: radha → aaron
Blocks: focusnav, atfmeta
-> Hewitt, who owns location bar focus issues meta bug
Assignee: aaron → hewitt
Summary: typing named anchor into address bar make address bar appear to keep focus → typing named anchor into address bar makes address bar appear to keep focus
Attachment #127245 - Flags: review?(bryner)
That's correct that mCurrentFocus should be null when the document doesn't have focus, but how is it getting set to something non-null to start with?
Brian, I´m cancelling out the side effect of SendFocusBlur(). Should I patch that routine instead not to cause the side effect, or find another way to write this method? I´m not completely confident about how to do the latter.
Brian, I tried to do this by having SendFocusBlur() not change mCurrentFocus. However, that created a problem because the focus outline doesn't then appear at the right time (for example if a link gets selected when you do a in page dialog find). It turns out that SetContentState() needs to use mCurrentFocus. To me, it seems easier to use this fix than to change both SendFocusBlur() and SetContentState() not to use mCurrentFocus. Or would you prefer me to make those respond to some kind of flag? It's easy with SendFocusBlur(), but SetContentState() would need to take a new boolean argument or use a global flag or new member variable.
Comment on attachment 127245 [details] [diff] [review] Null out mCurrent focus in FocusElementButNotDocument() when we're updating the focus appearance of a non-focused document. Otherwise the next blur event to this doc isn't fired. Hm. This entire method seems more complicated than I'd think it could be. Why can't we just update the focus controller's focused element without ever calling SendFocusBlur()?
Unfortunately, we have to make sure mCurrentFocus is set and then reset back to null. Otherwise, esm::GetContentState() doesn't tell layout to use :focus style rules for the element, and it won't get dotted out line.
Attachment #127245 - Attachment is obsolete: true
Attachment #128684 - Flags: review?(bryner)
Comment on attachment 128684 [details] [diff] [review] As simple as I can make it, without changing esm::GetContentState() Thanks, that's a _lot_ clearer. Hopefully it doesn't regress anything :^/
Attachment #128684 - Flags: review?(bryner) → review+
Comment on attachment 127245 [details] [diff] [review] Null out mCurrent focus in FocusElementButNotDocument() when we're updating the focus appearance of a non-focused document. Otherwise the next blur event to this doc isn't fired. -'ing this one since I hope we can go with the simplification patch.
Attachment #127245 - Flags: review?(bryner) → review-
Attachment #128684 - Flags: superreview?(jst)
Comment on attachment 128684 [details] [diff] [review] As simple as I can make it, without changing esm::GetContentState() + if (!focusController || !aContent) + return; ... + if (aContent) + mDocument->ContentStatesChanged(oldFocusedContent, aContent, NS_EVENT_STATE_FOCUS); You return early if !aContent, so you know it's not null here. No need for that if check. - FlushPendingEvents(mPresContext); Are you sure this isn't needed any more? Do pending events get flushed by some of the calls you make here, or does it not matter? sr=jst if you look into those issues.
Attachment #128684 - Flags: superreview?(jst) → superreview+
I don't think FlushPendingEvents() was ever needed. I put it in there originally because I was making it look like some other code. However, the way this method is used, it will always come after a keypress, and then there will be a pause for the layout system to catch up, unless the user does a find again or leaves the form, in either case that's okay. I can put it back it to be on the safe side, if you think that's wise.
Assignee: hewitt → aaronl
checked into trunk
Status: NEW → RESOLVED
Closed: 22 years ago
Resolution: --- → FIXED
I'm fine leaving it out, if you did (I didn't check), please keep your eyes open for any possible regressions caused by the omission of that call.
Component: History: Session → Document Navigation
QA Contact: claudius → docshell
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: