enact
enact copied to clipboard
WRR-1063: Add optional `options.preventScroll` parameter to `focus` function to prevent scroll by focus
Checklist
- [x] I have read and understand the contribution guide
- [x] A CHANGELOG entry is included
- [ ] At least one test case is included for this feature or bug fix
- [x] Documentation was added or is not needed
- [ ] This is an API breaking change
Issue Resolved / Feature Added
Spotlight.focus
API does not support preventScroll
option so that apps need to handle focus
event separately when they need to handle focusing for its own UX.
In normal cases, the focus should be stay in visible area for users so that scrolling by focus is natural behavior. But if apps need to handle focus moving not for visual effect but for any other business logic, they may want to prevent scroll by focus. We'd like to support these cases.
Resolution
Spotlight.focus
calls the standard focus
API internally, so updated our API to pass the option to the standard API.
Spotlight.focus
already has options called containerOption
so updated this option parameter like below.
- Renamed
containerOption
tooptions
in documents to avoid misunderstanding - Added a new option
preventDefault
Additional Considerations
This PR contains the original commit from #3177 and some more code refinements. Refer the original PR for the original contribution.
Links
WRR-1063 #3177 (The original contribution)
Comments
Enact-DCO-1.0-Signed-off-by: Nakjun Hwang ([email protected]) Enact-DCO-1.0-Signed-off-by: Seungcheon Baek ([email protected])