Closed Bug 296259 Opened 19 years ago Closed 18 years ago

div overflow:auto and content smaller than divsize should not get focus

Categories

(Core :: Layout, defect)

x86
Windows 2000
defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: Peter6, Assigned: moz_bug_r_a4)

References

Details

(Keywords: testcase)

Attachments

(2 files)

Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.8b2) Gecko/20050601
Firefox/1.0+ ID:2005060110

Open testcase and rightclick on the yellow block or tab to it
the content of the block is smaller than the div so it should not get focus
because there is nothing to scroll

somehow related to bug 264820 ?

testcase next
Attached file testcase
could you have a look Boris ?
Keywords: testcase
The testcase worksforme with current trunk (this morning's, basically) builds,
both Firefox and Seamonkey, on Linux.

I do get the focus outline when I tab to the div, which I believe is correct
(aaron, what's our current setup there?).  But I don't get a focus outline when
I right or left click on the div (which is also correct, since we decided to not
show focus outlines in that case).
Note that the outline triggers scrollbars if the element has content. See bug 294130
(In reply to comment #4)
> Note that the outline triggers scrollbars if the element has content. See bug
294130

Not in this case José.
(I can provide another testcase with more content than divsize if needed)

arghh, the summary should have been about overflow:auto , corrected now
Summary: div overflow:hidden and content smaller than divsize should not get focus → div overflow:auto and content smaller than divsize should not get focus
Like Boris, I don't get an outline if I click on the DIV, but I can tab to it.

I think this came up in another bug. I think we don't want tab order to depend
on how big the content of the DIV is. If we did, then for example changing
fontsize could alter tab order.
Dup of bug 257938, "Should css scrollable areas without scrollbars be tabbable?"?
Depends on: 257938
On Windows, I don't get a focus outline when I left-click on the div, but, I
*do* get a focus outline when I right-click on the div.

I think that the right-click issue is reproducible on Windows and OS/2 (though,
I can't test on OS/2).

http://lxr.mozilla.org/mozilla/source/content/xul/content/src/nsXULPopupListener.cpp

-----
 85 // on win32 and os/2, context menus come up on mouse up. On other platforms,
 86 // they appear on mouse down. Certain bits of code care about this difference.
 87 #if !defined(XP_WIN) && !defined(XP_OS2)
 88 #define NS_CONTEXT_MENU_IS_MOUSEUP 1
 89 #endif

-----
311 #ifndef NS_CONTEXT_MENU_IS_MOUSEUP
312     // If the context menu launches on mousedown,
313     // we have to fire focus on the content we clicked on
314     FireFocusOnTargetContent(targetNode);
315 #endif

-----
330 XULPopupListenerImpl::FireFocusOnTargetContent(nsIDOMNode* aTargetNode)
...
359     // Look for the nearest enclosing focusable frame.
360     while (currFrame) {
361         if (currFrame->IsFocusable()) {
362           newFocus = currFrame->GetContent();

Here, don't we need to pass PR_TRUE as aWithMouse argument to IsFocusable()?
I've tested this on Linux while removing NS_CONTEXT_MENU_IS_MOUSEUP, since I can't build on Windows for now.
Attachment #213993 - Flags: superreview?(roc)
Attachment #213993 - Flags: review?(aaronleventhal)
Attachment #213993 - Flags: review?(aaronleventhal) → review+
Attachment #213993 - Flags: superreview?(roc) → superreview+
Assignee: nobody → moz_bug_r_a4
I took the liberty of checking the patch in on trunk.  Thanks for the fix!

In general, though, you probably want to request review when you attach patches.  ;)
Status: NEW → RESOLVED
Closed: 18 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: