Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ dist: focal
language: node_js
node_js:
- lts/*
- node
- 21
Copy link
Member

Choose a reason for hiding this comment

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

Let's revert it back. :)

sudo: false
before_install:
- sudo apt-get update
Expand Down
35 changes: 19 additions & 16 deletions useScroll/useEvent.js
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,6 @@ const useEventKey = (props, instances, context) => {
const {keyCode, repeat} = ev;

forward('onKeyDown', ev, props);
ev.preventDefault();

spottable.current.animateOnFocus = true;

Expand Down Expand Up @@ -308,21 +307,25 @@ const pointerTracker = (ev) => {
const pageKeyHandler = (ev) => {
const {keyCode} = ev;

if (Spotlight.getPointerMode() && !Spotlight.getCurrent() && (isPageUp(keyCode) || isPageDown(keyCode))) {
const
{x, y} = lastPointer,
elem = document.elementFromPoint(x, y);

if (elem) {
for (const [key, value] of scrollers) {
if (utilDOM.containsDangerously(value, elem)) {
/* To handle page keys in nested scrollable components,
* break the loop only when `scrollByPageOnPointerMode` returns `true`.
* This approach assumes that an inner scrollable component is
* mounted earlier than an outer scrollable component.
*/
if (key.scrollByPageOnPointerMode(ev)) {
break;
if (isPageUp(keyCode) || isPageDown(keyCode)) {
ev.preventDefault();

if (Spotlight.getPointerMode() && !Spotlight.getCurrent()) {
const
{x, y} = lastPointer,
elem = document.elementFromPoint(x, y);

if (elem) {
for (const [key, value] of scrollers) {
if (utilDOM.containsDangerously(value, elem)) {
/* To handle page keys in nested scrollable components,
* break the loop only when `scrollByPageOnPointerMode` returns `true`.
* This approach assumes that an inner scrollable component is
* mounted earlier than an outer scrollable component.
*/
if (key.scrollByPageOnPointerMode(ev)) {
break;
}
}
}
}
Expand Down