-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implemented FocusCycler#forwardCycle
and #backwardCycle
events
#15050
Conversation
…SearchResultsView a focus-friendly container. Made SearchInfoView focusable.
0575ee6
to
3671b8b
Compare
if ( isViewWithFocusableChildren( view ) ) { | ||
if ( childrenFocusDirection === 1 ) { | ||
view.focusFirst(); | ||
} else if ( childrenFocusDirection === -1 ) { | ||
view.focusLast(); | ||
} | ||
} else { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What if I have a view that can be focused AND has focusable children? Shouldn't we let the view decide what it does upon being focused? EDIT: Actually, this is the definition of ViewWithFocusableChildren
:D. So, that view is in theory focusable but it will never actually get the focus because it will always focus its child.
I am not sure if this logic should be inside FocusCycler
but this is your domain so you decide.
/** | ||
* Checks whether a view is focusable. | ||
* | ||
* @param view A view to be checked. | ||
*/ | ||
function isFocusable( view: View & { focus?: unknown } ) { | ||
return !!( view.focus && isVisible( view.element ) ); | ||
function isPlainFocusableView( view: View ): view is FocusableView { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is a "plain focusable view"? AFAICS, the implementation did not change. If this is to differentiate "focusable" from "focusable with focusable children", I wouldn't make a change. To me, it felt like maybe "plain focsuable view" is a focusable that is not a "focusable with focusable children". But that's not true. I might not get something, but at the first glance, the change and the new name is confusing.
… implementing the focus() method.
@scofalik I went with your suggestions and moved the decision-making process down to implementers of the
|
…ties view using the FocusCycler events.
FYI: Recent changes to this PR (mainly: I addressed this issue and I took the liberty of using the new FC events in table forms to handle focus properly. Changes in 5f9bc87. |
Suggested merge commit message (convention)
Feature (ui): Implemented
FocusCycler#forwardCycle
and#backwardCycle
events.Internal (ui): Made
SearchResultsView
a focus-friendly container. MadeSearchInfoView
focusable.