feat(NcModal): expose initialFocus prop for focus-trap options#7587
feat(NcModal): expose initialFocus prop for focus-trap options#7587
initialFocus prop for focus-trap options#7587Conversation
c834c99 to
17df305
Compare
Signed-off-by: Maksim Sukharev <antreesy.web@gmail.com>
17df305 to
8afa991
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #7587 +/- ##
=======================================
Coverage 52.20% 52.20%
=======================================
Files 101 101
Lines 3174 3174
Branches 871 872 +1
=======================================
Hits 1657 1657
Misses 1271 1271
Partials 246 246 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
I forgot about that PR🪦 Shall we get it in? |
|
Was it for the translation dialog in chat? |
|
Yes, in general it fits for any dialog that does not need to have an initial focus on the child element |
With a small CSS fix, and by using available props and events we can make Would it also work for you? |
Depends on how it changes current default behaviour, and what app developers should do to implement it. I'd take a look =) |
|
Whats the current state of this PR? |
Ready to be merged for two months already 👀 |
|
What I am not sure about is whether we should focus the first element. |
susnux
left a comment
There was a problem hiding this comment.
IMHO this feature makes sense in some cases, for those I approve.
But if its really only about NcSelect then we can also fix that component
| /** Additional elements to add to the focus trap */ | ||
| additionalTrapElements?: Array<string | HTMLElement> | ||
|
|
||
| /** Set element to return focus to after focus trap deactivation */ |
There was a problem hiding this comment.
Maybe better
| /** Set element to return focus to after focus trap deactivation */ | |
| /** Set element to return focus to after dialog was closed */ |
| /** Set element to return focus to after focus trap deactivation */ | ||
| setReturnFocus?: FocusTargetOrFalse | ||
|
|
||
| /** Specify an element to receive initial focus after focus trap activation */ |
There was a problem hiding this comment.
| /** Specify an element to receive initial focus after focus trap activation */ | |
| /** Specify an element to receive initial focus after dialog was opened */ |
☑️ Resolves
initialFocusandsetReturnFocusto NcModal and NcDialog consumers🖼️ Screenshots
🚧 Tasks
🏁 Checklist
stable8for maintained Vue 2 version or not applicable