script: Implement autofocus delegate#45826
Conversation
Signed-off-by: Glenn Skrzypczak <glenn.skrzypczak@gmail.com>
7fc3827 to
cae6316
Compare
mrobinson
left a comment
There was a problem hiding this comment.
Nicely done. I think we should add support for the focus trigger for this too. You should be able to follow the cross-references of the various functions to see where it should be set, but generally I'd just fill it based on the caller.
| continue; | ||
| } | ||
|
|
||
| // > 6.2. Let focusable area be descendant, if descendant is a focusable area; otherwise |
There was a problem hiding this comment.
| // > 6.2. Let focusable area be descendant, if descendant is a focusable area; otherwise | |
| // > 1.2. Let focusable area be descendant, if descendant is a focusable area; otherwise |
| let focusable_area = if !kind.is_empty() { | ||
| return Some(FocusableArea::Node { | ||
| node: descendant, | ||
| kind, | ||
| }); | ||
| } else { | ||
| descendant.get_the_focusable_area() | ||
| }; |
There was a problem hiding this comment.
Any particular reason you are erasing the type of the focusable area here? I think losing IframeViewport is a bit of an issue. If there's no reason, this can be simplified:
| let focusable_area = if !kind.is_empty() { | |
| return Some(FocusableArea::Node { | |
| node: descendant, | |
| kind, | |
| }); | |
| } else { | |
| descendant.get_the_focusable_area() | |
| }; | |
| let focusable_area = match { | |
| Some(focusable_area) => return Some(focusable_area), | |
| None => descendant.get_the_focusable_area() | |
| }; |
There was a problem hiding this comment.
I do not quite get your suggestion. There is no focusable_area variable at that point.
There was a problem hiding this comment.
Oh, indeed. The thing missing here is how <iframe> is handled in focus.rs:129 (get_the_focusable_area). Maybe we can add a helper directly above that function fn focusable_area() with a comment that it is a helper for get_the_focusable_area (the specification function). This helper would handle <iframe> and also be used here.
Signed-off-by: Glenn Skrzypczak <glenn.skrzypczak@gmail.com>
Signed-off-by: Glenn Skrzypczak <glenn.skrzypczak@gmail.com>
This implements the autofocus delegate in order to focus elements with the autofocus attribute when opening dialogs.
Testing: Passes additional web platform tests.