-
Notifications
You must be signed in to change notification settings - Fork 116
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
ensure scroll position does not change when opening actionmenu #2411
Merged
jonrohan
merged 6 commits into
main
from
ensure-scroll-position-does-not-change-when-opening-actionmenu
Dec 15, 2023
Merged
ensure scroll position does not change when opening actionmenu #2411
jonrohan
merged 6 commits into
main
from
ensure-scroll-position-does-not-change-when-opening-actionmenu
Dec 15, 2023
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
🦋 Changeset detectedLatest commit: aef8227 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
keithamus
force-pushed
the
ensure-scroll-position-does-not-change-when-opening-actionmenu
branch
from
November 30, 2023 16:27
ff1c1ce
to
f6747be
Compare
github-actions
bot
added
the
javascript
Pull requests that update Javascript code
label
Nov 30, 2023
keithamus
force-pushed
the
ensure-scroll-position-does-not-change-when-opening-actionmenu
branch
from
December 1, 2023 11:38
ff4e8f1
to
ab503c2
Compare
orhantoy
reviewed
Dec 1, 2023
keithamus
force-pushed
the
ensure-scroll-position-does-not-change-when-opening-actionmenu
branch
from
December 5, 2023 10:38
45b4f30
to
e2a8241
Compare
keithamus
force-pushed
the
ensure-scroll-position-does-not-change-when-opening-actionmenu
branch
from
December 5, 2023 10:38
e2a8241
to
89f5601
Compare
keithamus
force-pushed
the
ensure-scroll-position-does-not-change-when-opening-actionmenu
branch
from
December 5, 2023 10:42
89f5601
to
0027574
Compare
This comment was marked as outdated.
This comment was marked as outdated.
By using the `toggle` event we can ensure the popover is open and positioned (positioning happens during `beforetoggle`) before trying to focus the element.
keithamus
force-pushed
the
ensure-scroll-position-does-not-change-when-opening-actionmenu
branch
from
December 5, 2023 12:32
0ead775
to
f6a8725
Compare
…opening-actionmenu
Could we have a system test for this? |
github-actions
bot
removed
the
javascript
Pull requests that update Javascript code
label
Dec 14, 2023
jonrohan
approved these changes
Dec 15, 2023
jonrohan
deleted the
ensure-scroll-position-does-not-change-when-opening-actionmenu
branch
December 15, 2023 18:48
Merged
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What are you trying to accomplish?
Sometimes opening the actionmenu causes the page to jump to the top, due to subtle timing issues with the anchored element positioning itself; it starts at the top of the page and only positions itself when visible. The actionmenu focusses the first element and if the menu hasn't had time to position itself, the page will jump. This fixes that.
Integration
No
List the issues that this change affects.
Closes https://github.com/github/primer/issues/2897, https://github.com/github/primer/issues/2900
Risk Assessment
What approach did you choose and why?
I moved the focus to the
toggle
event, which is fired after the popover is opened.anchored-position
positions the element on abeforetoggle
event which is always fired before the element becomes visible, so the position should be correct and the page won't jump.Anything you want to highlight for special attention from reviewers?
No
Accessibility
Merge checklist
Take a look at the What we look for in reviews section of the contributing guidelines for more information on how we review PRs.