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-9115: Scroller: Fixed to focus properly when the spottable node is bigger than the viewport by scrolling with voice control #1748

Merged
merged 3 commits into from
Dec 2, 2024
Merged
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
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

The following is a curated list of changes in the Enact sandstone module, newest changes on the top.

## [unreleased]

### Fixed

- `sandstone/Scroller` to focus properly when the spottable node is bigger than the size of viewport by voice control

## [3.0.0-alpha.3] - 2024-12-02

### Added
Expand Down
4 changes: 2 additions & 2 deletions useScroll/useEvent.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import {onWindowReady} from '@enact/core/snapshot';
import {clamp} from '@enact/core/util';
import Spotlight, {getDirection} from '@enact/spotlight';
import {getPositionTargetOnFocus} from '@enact/spotlight/src/container';
import {getDeepSpottableDescendants, getPositionTargetOnFocus} from '@enact/spotlight/src/container';
import {getRect} from '@enact/spotlight/src/utils';
import {getTargetByDirectionFromElement} from '@enact/spotlight/src/target';
import {constants} from '@enact/ui/useScroll';
Expand Down Expand Up @@ -449,7 +449,7 @@

/* if the focused element is out of the viewport, find another spottable element in the viewport */
if (spotItemBounds[last] <= viewportBounds[first] || spotItemBounds[first] >= viewportBounds[last]) {
const nodes = Spotlight.getSpottableDescendants(scrollContainerNode.dataset.spotlightId);
const nodes = getDeepSpottableDescendants(scrollContainerNode.dataset.spotlightId);

Check warning on line 452 in useScroll/useEvent.js

View check run for this annotation

Codecov / codecov/patch

useScroll/useEvent.js#L452

Added line #L452 was not covered by tests
for (let i = 0; i < nodes.length; i++) {
const nodeBounds = nodes[i].getBoundingClientRect();

Expand Down