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 6 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 ([email protected])
Enact-DCO-1.0-Signed-off-by: Seungcheon Baek ([email protected])

nakjun12 and others added 2 commits September 5, 2024 13:44
Enact-DCO-1.0-Signed-off-by: Seungcheon Baek ([email protected])
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.30%. Comparing base (8cda002) to head (891cb1b).

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.30%   82.30%           
========================================
  Files          152      152           
  Lines         7091     7091           
  Branches      1867     1867           
========================================
  Hits          5836     5836           
  Misses         985      985           
  Partials       270      270           

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


🚨 Try these New Features:

Enact-DCO-1.0-Signed-off-by: Seungcheon Baek ([email protected])

### Changed

- Renamed `spotlight` an optional `containerOption` parameter of `focus` function to `options` to avoid misunderstandings
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this changelog necessary? Developers doesn't specify the parameter's name when they call Spotlight.focus.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought the same manner at first time but we already mentioned containerOption twice in changelogs. I wanted to remove this log honestly.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, removed. At least both of us do not want it. ;)

Copy link
Contributor

@MikyungKim MikyungKim left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

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.

3 participants