Skip to content

Commit

Permalink
For undefined init focus id we should focus on first focus able eleme…
Browse files Browse the repository at this point in the history
…nt in container

- in current case we did not have any fallback for cases like undefined init focus
- it is simple that if no focus-able id defined then we will add focus on first focus-able element

Signed-off-by: Darshan-upadhyay1110 <[email protected]>
Change-Id: Idf82a892569ced0a70538df4e488296217a51cdc
  • Loading branch information
Darshan-upadhyay1110 authored and eszkadev committed Jan 3, 2025
1 parent 5585cc8 commit 4c3a229
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion browser/src/control/Control.JSDialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,8 @@ L.Control.JSDialog = L.Control.extend({

} else {
// will directly set element of focusable element based on init focus id
firstFocusableElement = instance.init_focus_id ? instance.container.querySelector('[id=\'' + instance.init_focus_id + '\']') : null;
// If init_id is not defined, select the first focusable element from the container
firstFocusableElement = instance.init_focus_id ? instance.container.querySelector('[id=\'' + instance.init_focus_id + '\']') : JSDialog.GetFocusableElements(instance.container);
}

if (firstFocusableElement && document.activeElement !== firstFocusableElement && instance.canHaveFocus) {
Expand Down

0 comments on commit 4c3a229

Please sign in to comment.