WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
101369
AX: Textfields don't get focus when navigated to from 'show all tabs' button
https://bugs.webkit.org/show_bug.cgi?id=101369
Summary
AX: Textfields don't get focus when navigated to from 'show all tabs' button
chris fleizach
Reported
2012-11-06 10:30:23 PST
When going from the tabs to HTML content with a text field, the keyboard focus remains on a previous element. You can't type in the field when it's not focused.
Attachments
patch
(2.58 KB, patch)
2012-11-06 10:35 PST
,
chris fleizach
no flags
Details
Formatted Diff
Diff
patch
(2.62 KB, patch)
2012-11-06 11:39 PST
,
chris fleizach
no flags
Details
Formatted Diff
Diff
Show Obsolete
(1)
View All
Add attachment
proposed patch, testcase, etc.
chris fleizach
Comment 1
2012-11-06 10:30:39 PST
rdar://12263874
chris fleizach
Comment 2
2012-11-06 10:35:20 PST
Created
attachment 172614
[details]
patch
Darin Adler
Comment 3
2012-11-06 10:50:39 PST
Comment on
attachment 172614
[details]
patch View in context:
https://bugs.webkit.org/attachment.cgi?id=172614&action=review
> Source/WebCore/accessibility/AccessibilityRenderObject.cpp:1506 > + Document* document = this->document(); > if (!on) > - m_renderer->document()->setFocusedNode(0); > + document->setFocusedNode(0); > else { > - if (m_renderer->node()->isElementNode()) > - static_cast<Element*>(m_renderer->node())->focus(); > + Node* node = this->node(); > + // If this node is already the currently focused node, then calling focus() won't do anything. > + // That is a problem when focus is removed from the webpage to chrome, and then returns. > + // In these cases, we need to do what keyboard and mouse focus do, which is reset focus first. > + if (document->focusedNode() == node) > + document->setFocusedNode(0); > + > + if (node && node->isElementNode()) > + toElement(node)->focus(); > else > - m_renderer->document()->setFocusedNode(m_renderer->node()); > + document->setFocusedNode(node); > }
Is there some way to share this code rather than repeating this logic here?
chris fleizach
Comment 4
2012-11-06 10:59:58 PST
(In reply to
comment #3
)
> (From update of
attachment 172614
[details]
) > View in context:
https://bugs.webkit.org/attachment.cgi?id=172614&action=review
> > > Source/WebCore/accessibility/AccessibilityRenderObject.cpp:1506 > > + Document* document = this->document(); > > if (!on) > > - m_renderer->document()->setFocusedNode(0); > > + document->setFocusedNode(0); > > else { > > - if (m_renderer->node()->isElementNode()) > > - static_cast<Element*>(m_renderer->node())->focus(); > > + Node* node = this->node(); > > + // If this node is already the currently focused node, then calling focus() won't do anything. > > + // That is a problem when focus is removed from the webpage to chrome, and then returns. > > + // In these cases, we need to do what keyboard and mouse focus do, which is reset focus first. > > + if (document->focusedNode() == node) > > + document->setFocusedNode(0); > > + > > + if (node && node->isElementNode()) > > + toElement(node)->focus(); > > else > > - m_renderer->document()->setFocusedNode(m_renderer->node()); > > + document->setFocusedNode(node); > > } > > Is there some way to share this code rather than repeating this logic here?
I couldn't think of a way to do that easily without altering long-standing behavior. What I thought might be reasonable would be to call setFocusedNode(0) when the WebPage loses focus, but I wasn't sure of the implications of doing that. The document's notion of what is focused would be lost. Maybe that's not important, but it was hard to know. The keyboard tabbing method always assumes that focus will be on the first focusable item when it sets focus. The mouse method is tied up heavily in normal mouse event handling. The addition here (minus the refactoring) are just these two lines
>> + if (document->focusedNode() == node) > > + document->setFocusedNode(0);
so it's not a lot of duplication
Darin Adler
Comment 5
2012-11-06 11:07:41 PST
Comment on
attachment 172614
[details]
patch View in context:
https://bugs.webkit.org/attachment.cgi?id=172614&action=review
> Source/WebCore/accessibility/AccessibilityRenderObject.cpp:1500 > + if (document->focusedNode() == node) > + document->setFocusedNode(0);
Is this needed for the non-element case, or only for the element case?
chris fleizach
Comment 6
2012-11-06 11:33:57 PST
(In reply to
comment #5
)
> (From update of
attachment 172614
[details]
) > View in context:
https://bugs.webkit.org/attachment.cgi?id=172614&action=review
> > > Source/WebCore/accessibility/AccessibilityRenderObject.cpp:1500 > > + if (document->focusedNode() == node) > > + document->setFocusedNode(0); > > Is this needed for the non-element case, or only for the element case?
I think this would only ever be an issue in the element case. I can limit it to that
chris fleizach
Comment 7
2012-11-06 11:39:30 PST
Created
attachment 172626
[details]
patch patch that only applies this logic to Element types (instead of all Nodes)
Darin Adler
Comment 8
2012-11-07 10:04:41 PST
Comment on
attachment 172626
[details]
patch OK, I can live with this, but there’s something about this that seems wrong. I don’t see why there’s no function on node to do this whole dance.
WebKit Review Bot
Comment 9
2012-11-07 11:24:37 PST
Comment on
attachment 172626
[details]
patch Clearing flags on attachment: 172626 Committed
r133785
: <
http://trac.webkit.org/changeset/133785
>
WebKit Review Bot
Comment 10
2012-11-07 11:24:41 PST
All reviewed patches have been landed. Closing bug.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug