Closed Bug 303428 Opened 19 years ago Closed 15 years ago

Focus ring can end up on an inactive tab

Categories

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

defect

Tracking

()

RESOLVED FIXED

People

(Reporter: polidobj, Unassigned)

References

(Blocks 1 open bug)

Details

Attachments

(4 obsolete files)

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8b4) Gecko/20050804 Firefox/1.0+
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8b4) Gecko/20050804 Firefox/1.0+

The focus ring on the tab bar does not go away or move to the new active tab in
the scenario given.

Reproducible: Always

Steps to Reproduce:
1. Put a focus ring on the current active bu clicking on it.
2. Open a bookmark in a new tab from the bookmark menu or the bookmark toolbar.
 Do this by middle clicking or Ctrl-clicking on a bookmark or use a open in tabs
menu item to open multiple bookmarks in tabs.  Don't use a context menu or the
bookmark sidebar.
3. A new tab will become the active tab but the focus ring will remain on the
previous active tab.

Actual Results:  
Focus ring appears on an inactive tab.

Expected Results:  
Whichever is deemed more appropriate: 
The focus ring should no longer appear.
The focus ring appears on the new active tab.
Confirmed.
Might have something to do with bug 264820.
Status: UNCONFIRMED → NEW
Ever confirmed: true
I also see this happens on a Mac at least in the case of clicking on a bookmark
toolbar bookmark with the apple key pressed with the focus indicator present on
the active tab.
Nightly with the same date as comment #0.
OS->ALL  
OS: Windows XP → All
Hardware: PC → All
I can't determine if this affects the bookmarks menu on the Mac because of bug
262388.
This would be only a visual problem IMHO if it also activated the tabscrolling
but it doesn't.
Flags: blocking1.8b4?
Mike can you take a look?
Assignee: nobody → mconners
Flags: blocking1.8b4? → blocking1.8b4+
Assignee: mconners → mconnor
Bumping to aaron after discussion on IRC, he's been handling issues in the tab
focus impl that he created for 1.5.
Version: unspecified → Trunk
re-bumping.  Aaron, let me know tomorrow if you're not going to have cycles for
this.
Assignee: mconnor → aaronleventhal
Whiteboard: [ETA: 8/25]
Is this a regression from my setTimeout checkin for bug 249136 on 8/5/2005 ?
I'm planning to back that out for a better fix anyway.
(In reply to comment #8)
> Is this a regression from my setTimeout checkin for bug 249136 on 8/5/2005 ?
> I'm planning to back that out for a better fix anyway.

No, duh. The reporter was using a build from 8/4/2005.
I was able to duplicate this before, but this is WFM in the 8/17/2005 branch build.
Whiteboard: [ETA: 8/25] → [ETA: This is WFM -- seeking confirmation]
Confirmed. Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8b4)
Gecko/20050818 Firefox/1.0+
I can still reproduce with Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US;
rv:1.9a1) Gecko/20050820 Firefox/1.6a1 ID:2005082018 by Ctrl-clicking a
bookmark, though open in tabs WFM.
I still see it also, 

Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9a1) Gecko/20050820
Firefox/1.6a1

I would imagine it has to do with the fact that I have to click to get a focus
ring, ctrl-tabbing through the tabs doesn't create one. If I click somewhere
else first (i.e. right click on a bookmark or link) or even left click a
bookmark to open it in current tab, focus ring disappears.
Using the Open in Tabs menu item is WFM now.  But middle click and ctrl-click
still shown the bug.  
I cannot repro with Ctrl+click using the following steps:

1. Launch Firefox, with bookmarks sidebar already open
2. Click on current tab so it is focused and shows focus ring
3. Ctrl+click on bookmark to mozilla.org

Focus ring goes away as new tab's content has focus.
I had said in the intial bug report that the bookmark sidebar does not exhibit
the problem.  Only the bookmark menu and the bookmark toolbar do.  

I also just found that middle clicking or ctrl-clicking on the back button, the
forward button, the throbber, the home button and entries in the go menu also
show the same problem.  

Oh and possibly another bug is that the home menu item on the go menu does
nothing when middle clicked and opens the homepage in the current tab when
ctrl-clicked.  

Also when a tab has the focus ring the copy command is enabled on the edit menu
but doesn't copy anything because I can't paste anything into notepad even if I
have text selected in the page.  And select all is enabled but does nothing when
selected.

But I haven't searched if any of those have been filed. 
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8b4) Gecko/20050821
Firefox/1.0+ ID:2005082106
(In reply to comment #16)
> I had said in the intial bug report that the bookmark sidebar does not exhibit
> the problem.  Only the bookmark menu and the bookmark toolbar do.  

Okay, I spaced that. It's dain bramage from too many late nights getting ready
for this release.

So, SetContentState(EVENT_STATE_FOCUS) is possibly not doing its job.

Another way to repro this is to focus a tab, and then hit ctrl+b twice. The
current tab has a focus outline even though it's the content with focus.
Is this left over from/regression to mconnor's reorder tabs thing? (I do seem to
recall he had some issues with the focus rings when he was implementing it, but
that was a while ago)

If I ctrl-click or middle click not only does it leave the focus ring, but I can
leave the focus ring on the old tab and create a focus ring on the new tab. I
can click on other tabs and creat a focus ring there. The original focus ring
goes AWAY when I click on the original tab or one of the tabs that is next to
the original tab with the focus ring.  Also if I reorder tabs, original focus
ring persists until I move a tab beside the tab with the original ring.
For me the focus ring disappears as soon as I hit Ctrl-B.
When we switch focus to another window, we never call SetContentState(...,
NS_EVENT_STATE_FOCUS). Not sure where we should try to do that ... ESM's
NS_GOTFOCUS handling, or nsGlobalWindow::Focus() ? How do we avoid getting into
a circular loop?

I would think this means we get into other kinds of trouble, such as not firing
the right blur events.
Perhaps this problem is related to Brian Ryner's comments here:
http://bonsai.mozilla.org/cvsblame.cgi?file=mozilla/content/events/src/nsEventStateManager.cpp#586
 586   if (!mCurrentFocus && gLastFocusedContent) {
 587     // We also need to blur the previously focused content node here,
 588     // if we don't have a focused content node in this document.
 589     // (SendFocusBlur isn't called in this case).
 
Whiteboard: [ETA: This is WFM -- seeking confirmation] → [ETA: not sure how to fix in a non-risky way, core focus code]
I have experienced the lack of proper blur events in bug 302136... blur events
are not fired at a XUL window when we switch focus to a different window.
Whiteboard: [ETA: not sure how to fix in a non-risky way, core focus code] → [ETA: not sure how to fix in a non-risky way, core focus code, I need help from Bryner if we can get this one at all]
this is cosmetic only, and the fix is too risky at this stage, minusing.
Flags: blocking1.8b4+ → blocking1.8b4-
*** Bug 308991 has been marked as a duplicate of this bug. ***
Flags: blocking1.9a1?
Attached patch alternative patch (obsolete) — Splinter Review
Sorry for butting in but I've got an alternative patch that fixes the bug for me.

So, from what I gather... if the the focus ring is on a tab, updateCurrentBrowser() will not try to focus the content. This is perfectly valid and the behavior should not be changed. See http://lxr.mozilla.org/mozilla/source/toolkit/content/widgets/tabbrowser.xml#750

With this patch the focus ring will be on the tab that is being activated.
Attachment #239399 - Flags: review?(mconnor)
I can't reproduce this bug anymore.  But having the focus ring on the new active tab sounds like it might be a good thing to have.  
Blocks: focusnav
Flags: blocking1.9a1?
(restoring lost blocking request)
Flags: blocking-firefox3?
Comment on attachment 239399 [details] [diff] [review]
alternative patch

you need to make this _selectNewTab now that bug 370742 has landed.  r=me with that
Attachment #239399 - Flags: review?(mconnor) → review+
Whiteboard: [ETA: not sure how to fix in a non-risky way, core focus code, I need help from Bryner if we can get this one at all] → [checkin needed]
comment #28:
> you need to make this _selectNewTab now that bug 370742 has landed.  r=me with
> that
Oliver, could you post the (tested) updated patch?
Assignee: aaronleventhal → oliver_yeoh
Target Milestone: --- → Firefox 3 alpha5
Flags: blocking-firefox3? → blocking-firefox3+
Attached patch updated patch (obsolete) — Splinter Review
Attachment #193498 - Attachment is obsolete: true
Attachment #239399 - Attachment is obsolete: true
mozilla/toolkit/content/widgets/tabbox.xml 	1.45
Status: NEW → RESOLVED
Closed: 17 years ago
Resolution: --- → FIXED
Whiteboard: [checkin needed]
Depends on: 382766
This caused bug 382766, which is a major dogfood issue. Please either fix that or back this out asap.
I've backed out this patch, because the regression it caused (bug 382766) was worse than the bug it was fixing, and because I'm not sure it was a correct change in general. It seems to me like the fix for this bug should focus on the bookmark case specifically, since it seems to do things differently, at first glance.
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
Target Milestone: Firefox 3 alpha5 → ---
Target Milestone: --- → Firefox 3 alpha6
Target Milestone: Firefox 3 alpha6 → Firefox 3 beta1
Target Milestone: Firefox 3 M7 → Firefox 3 M9
Target Milestone: Firefox 3 M9 → Firefox 3 M10
Attached patch css workaround (obsolete) — Splinter Review
At least visually this should do the trick, but I don't know if this bug has other side effects. Aaron, can you tell that?
Attachment #266496 - Attachment is obsolete: true
Attachment #283201 - Flags: review?(mconnor)
Assignee: oliver_yeoh → nobody
Status: REOPENED → NEW
Ah, I think I hit this bug in bug 367806. I attached a neat testcase in that bug:
https://bugzilla.mozilla.org/attachment.cgi?id=275430
and I think that's basically the same issue.
Assignee: nobody → dao
Target Milestone: Firefox 3 M10 → Firefox 3 M9
Status: NEW → ASSIGNED
not an M9 blocker
Target Milestone: Firefox 3 M9 → Firefox 3 M10
Back to the default assignee then. Maybe somebody figures out a fix for the Core bug.
Assignee: dao → nobody
Status: ASSIGNED → NEW
Actually this should be a Core bug to start with. At this point I'm not changing the component as this would mean to lose the blocking flag.
Target Milestone: Firefox 3 M10 → Firefox 3 M11
Priority: -- → P5
Whiteboard: [has CSS patch]
I'm no longer sure this blocks, but this should be a core bug.
Component: Tabbed Browser → Keyboard: Navigation
Flags: blocking-firefox3+
Product: Firefox → Core
QA Contact: tabbed.browser → keyboard.navigation
Target Milestone: Firefox 3 Mx → ---
Flags: blocking1.9?
Whiteboard: [has CSS patch]
Comment on attachment 283201 [details] [diff] [review]
css workaround

If the bug remains unfixed, I still think we should add [selected="true"] as a workaround for Firefox. This patch isn't up to date, though.
Attachment #283201 - Attachment is obsolete: true
Attachment #283201 - Flags: review?(mconnor)
Flags: blocking1.9? → blocking1.9+
(In reply to comment #0)
> The focus ring on the tab bar does not go away or move to the new active tab 

In the current builds, the focus ring stays on the old inactive tab but also appears in the new active tab if you click on the active tab. You end up with two focus rings.
Blocks: 417904
Flags: tracking1.9+ → wanted-next+
Depends on: 178324
This bug should have been fixed by 178324.
Status: NEW → RESOLVED
Closed: 17 years ago15 years ago
Resolution: --- → FIXED
Blocks: 500019
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: