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

fix(article-detail): adjust page up/down scroll height for floating toolbar #4491

Merged
merged 3 commits into from
May 29, 2024

Conversation

byhow
Copy link
Contributor

@byhow byhow commented May 28, 2024

Since the presence of a floating toolbar, the normal scroll height for page up/down (fn + up/down key on OSX) hides some pixels. Now it will offset the height by the height of the toolbar

close: #4370

Copy link

vercel bot commented May 28, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
matters-web ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 29, 2024 4:00am

@byhow byhow marked this pull request as ready for review May 28, 2024 19:08
@byhow byhow requested a review from a team as a code owner May 28, 2024 19:08
const remInPixels = parseFloat(
getComputedStyle(document.documentElement).fontSize
)
const scrollDirection = event.code.toLowerCase() === 'pagedown' ? 1 : -1
Copy link
Contributor

Choose a reason for hiding this comment

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

space should be 1

Copy link
Contributor Author

Choose a reason for hiding this comment

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

good call! just updated along with the keyValue enum

// offsetting it with the height of floating toolbar
useNativeEventListener('keydown', (event: KeyboardEvent) => {
if (
event.code.toLowerCase() === 'pagedown' ||
Copy link
Contributor

Choose a reason for hiding this comment

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

there is a key code mapping at src/common/enums/keyValue.ts

@byhow byhow force-pushed the fix/align-page-down-event branch from 526ba43 to 286b0eb Compare May 29, 2024 03:55
@byhow byhow merged commit cd21e8c into develop May 29, 2024
5 of 6 checks passed
@delete-merged-branch delete-merged-branch bot deleted the fix/align-page-down-event branch May 29, 2024 04:29
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.

Adjust page down
2 participants