Skip to content
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

WRR-1063: Add optional options.preventScroll parameter to focus function to prevent scroll by focus #3277

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from

Conversation

0x64
Copy link
Member

@0x64 0x64 commented Sep 10, 2024

Checklist

  • I have read and understand the contribution guide
  • A CHANGELOG entry is included
  • At least one test case is included for this feature or bug fix
  • 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 to options 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 (wns450@gmail.com)
Enact-DCO-1.0-Signed-off-by: Seungcheon Baek (sc.baek@lge.com)

nakjun12 and others added 2 commits September 5, 2024 13:44
Enact-DCO-1.0-Signed-off-by: Nakjun Hwang <wns450@gmail.com>
Enact-DCO-1.0-Signed-off-by: Seungcheon Baek (sc.baek@lge.com)
Copy link

codecov bot commented Sep 10, 2024

Codecov Report

Attention: Patch coverage is 87.50000% with 1 line in your changes missing coverage. Please review.

Project coverage is 82.27%. Comparing base (daf593c) to head (3662e69).

Files with missing lines Patch % Lines
packages/spotlight/src/spotlight.js 87.50% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff            @@
##           develop    #3277   +/-   ##
========================================
  Coverage    82.27%   82.27%           
========================================
  Files          152      152           
  Lines         7090     7090           
  Branches      1866     1866           
========================================
  Hits          5833     5833           
  Misses         986      986           
  Partials       271      271           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants