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

WRN-851: Remove hasPointerMoved from spotlight and spotlight/SpotlightContainerDecorator #2954

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
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
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 project, newest changes on the top.

## [unreleased]

### Fixed

- `spotlight` and `spotlight/SpotlightContainerDecorator` to handle pointer events even when pointer hasn't moved.

## [4.0.7] - 2021-09-28

### Fixed
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
import {forProp, handle, not, stop} from '@enact/core/handle';

import {hasPointerMoved} from '../src/pointer';
import Spotlight from '../src/spotlight';

const isNewPointerPosition = (ev) => hasPointerMoved(ev.clientX, ev.clientY);

class SpotlightContainer {
// set up context and props so we can use handle binding
context = {};
Expand Down Expand Up @@ -114,13 +111,11 @@ class SpotlightContainer {
};

onPointerEnter = handle(
isNewPointerPosition,
() => Spotlight.setActiveContainer(this.id)
).bindAs(this, 'onPointerEnter');

onPointerLeave = handle(
not(forProp('restrict', 'self-only')),
isNewPointerPosition,
(ev) => {
const parentContainer = ev.currentTarget.parentNode.closest('[data-spotlight-container]');
let activeContainer = Spotlight.getActiveContainer();
Expand Down
3 changes: 1 addition & 2 deletions packages/spotlight/src/spotlight.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ import {
import {
getLastPointerPosition,
getPointerMode,
hasPointerMoved,
notifyKeyDown,
notifyPointerMove,
setPointerMode
Expand Down Expand Up @@ -513,7 +512,7 @@ const Spotlight = (function () {

const {target} = evt;

if (getPointerMode() && hasPointerMoved(evt.clientX, evt.clientY)) {
if (getPointerMode()) {
const next = getNavigableTarget(target); // account for child controls

if (next && next !== getCurrent()) {
Expand Down