From 0ea0a1b6b4da31ec4a4ccd5543e18ccf0398e37d Mon Sep 17 00:00:00 2001 From: Jiye Kim Date: Mon, 1 Apr 2024 17:34:27 +0900 Subject: [PATCH 1/6] WRQ-9560: Fix scrolling by pageup/down key by preventing default behavior Enact-DCO-1.0-Signed-off-by: Jiye Kim (jiye.kim@lge.com) --- useScroll/useEvent.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/useScroll/useEvent.js b/useScroll/useEvent.js index ce46d7975d..b5c5fbc5f2 100644 --- a/useScroll/useEvent.js +++ b/useScroll/useEvent.js @@ -307,6 +307,9 @@ const pointerTracker = (ev) => { const pageKeyHandler = (ev) => { const {keyCode} = ev; + if (isPageUp(keyCode) || isPageDown(keyCode) || (keyCode === 35) || (keyCode === 36)) { + ev.preventDefault(); + } if (Spotlight.getPointerMode() && !Spotlight.getCurrent() && (isPageUp(keyCode) || isPageDown(keyCode))) { const From 5f7e162161e7e189de9de6b6dd8dcba3bd3b1423 Mon Sep 17 00:00:00 2001 From: Jiye Kim Date: Mon, 1 Apr 2024 18:16:12 +0900 Subject: [PATCH 2/6] not preventDefault home/end key --- useScroll/useEvent.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/useScroll/useEvent.js b/useScroll/useEvent.js index b5c5fbc5f2..dc0abe4b52 100644 --- a/useScroll/useEvent.js +++ b/useScroll/useEvent.js @@ -307,11 +307,9 @@ const pointerTracker = (ev) => { const pageKeyHandler = (ev) => { const {keyCode} = ev; - if (isPageUp(keyCode) || isPageDown(keyCode) || (keyCode === 35) || (keyCode === 36)) { - ev.preventDefault(); - } if (Spotlight.getPointerMode() && !Spotlight.getCurrent() && (isPageUp(keyCode) || isPageDown(keyCode))) { + ev.preventDefault(); const {x, y} = lastPointer, elem = document.elementFromPoint(x, y); From 73e58a7d4d40c490d2af8c05a1f0f830795ef0ba Mon Sep 17 00:00:00 2001 From: Jiye Kim Date: Thu, 4 Apr 2024 11:34:38 +0900 Subject: [PATCH 3/6] add ui test Enact-DCO-1.0-Signed-off-by: Jiye Kim (jiye.kim@lge.com) --- .../Scroller/Scroller-nativeScroll-specs.js | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/tests/ui/specs/Scroller/Scroller-nativeScroll-specs.js b/tests/ui/specs/Scroller/Scroller-nativeScroll-specs.js index 566ef20b79..309054824b 100644 --- a/tests/ui/specs/Scroller/Scroller-nativeScroll-specs.js +++ b/tests/ui/specs/Scroller/Scroller-nativeScroll-specs.js @@ -299,4 +299,30 @@ describe('Scroller', function () { expect((await ScrollerPage.getScrollThumbPosition()).horizontal > initialHorizontalScrollThumbPosition).to.be.true(); }); }); + + describe('Page Scroll', function () { + it('should scroll with pressed pageUp/Down key only when pointer is in the Scroller.', async function () { + await ScrollerPage.open(); + let verticalScrollTumbPosition = (await ScrollerPage.getScrollThumbPosition()).vertical; + expect(await verticalScrollTumbPosition).to.equal('0'); + await ScrollerPage.scroller.moveTo(); + await ScrollerPage.pageDown(); + await ScrollerPage.delay(1000); + verticalScrollTumbPosition = (await ScrollerPage.getScrollThumbPosition()).vertical; + expect(await verticalScrollTumbPosition).not.to.equal('0'); + await ScrollerPage.pageUp(); + await ScrollerPage.delay(1000); + verticalScrollTumbPosition = (await ScrollerPage.getScrollThumbPosition()).vertical; + expect(await verticalScrollTumbPosition).to.equal('0'); + await ScrollerPage.buttonHideScrollbar.moveTo(); + await ScrollerPage.pageDown(); + await ScrollerPage.delay(1000); + verticalScrollTumbPosition = (await ScrollerPage.getScrollThumbPosition()).vertical; + expect(await verticalScrollTumbPosition).to.equal('0'); + await ScrollerPage.pageUp(); + await ScrollerPage.delay(1000); + verticalScrollTumbPosition = (await ScrollerPage.getScrollThumbPosition()).vertical; + expect(await verticalScrollTumbPosition).to.equal('0'); + }); + }); }); From b83c252a64892b7ba55bd90cfd642797f56d0bbf Mon Sep 17 00:00:00 2001 From: Jiye Kim Date: Tue, 16 Apr 2024 19:06:04 +0900 Subject: [PATCH 4/6] add home/end key to nonModal list Enact-DCO-1.0-Signed-off-by: Jiye Kim (jiye.kim@lge.com) --- ThemeDecorator/ThemeDecorator.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ThemeDecorator/ThemeDecorator.js b/ThemeDecorator/ThemeDecorator.js index 38c451dcc3..621a081819 100644 --- a/ThemeDecorator/ThemeDecorator.js +++ b/ThemeDecorator/ThemeDecorator.js @@ -216,7 +216,9 @@ const ThemeDecorator = hoc(defaultConfig, (config, Wrapped) => { 405, // yellow 406, // blue 33, // channel up - 34 // channel down + 34, // channel down + 35, // end + 36 // home ], red: 403, green: 404, From df78be5699ba87a6f1313b9f92eb86a0607a8fc0 Mon Sep 17 00:00:00 2001 From: Jiye Kim Date: Wed, 17 Apr 2024 11:45:43 +0900 Subject: [PATCH 5/6] add ui test for virtualList Enact-DCO-1.0-Signed-off-by: Jiye Kim (jiye.kim@lge.com) --- .../VirtualList/VirtualList-specs.js | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/tests/ui/specs/VirtualList/VirtualList/VirtualList-specs.js b/tests/ui/specs/VirtualList/VirtualList/VirtualList-specs.js index d2d88688b0..e1004dc568 100644 --- a/tests/ui/specs/VirtualList/VirtualList/VirtualList-specs.js +++ b/tests/ui/specs/VirtualList/VirtualList/VirtualList-specs.js @@ -129,4 +129,36 @@ describe('VirtualList', function () { await expectFocusedItem(5, 'focus Item 05'); }); }); + + describe('Page Scroll', function () { + it('should scroll with pressed pageUp/Down key only when focus is in the VirtualList.', async function () { + await Page.open(); + // Scroll thumb is on the initial position + expect(await Page.getScrollThumbPosition()).to.equal('0'); + // Move focus to VirtualList + await (await Page.item(0)).moveTo(); + // Scroll by pageDown key + await Page.pageDown(); + await Page.delay(1000); + // VirtualList is scrolled and scroll thumb is moved + expect(await Page.getScrollThumbPosition()).not.to.equal('0'); + // Scroll by pageUp key + await Page.pageUp(); + await Page.delay(1000); + // VirtualList is scrolled and scroll thumb is moved to initial position + expect(await Page.getScrollThumbPosition()).to.equal('0'); + // Move focus to buttonHideScrollbar + await (await Page.buttonHideScrollbar).moveTo(); + // Press pageDown key + await Page.pageDown(); + await Page.delay(1000); + // VirtualList is not scrolled and scroll thumb is not moved + expect(await Page.getScrollThumbPosition()).to.equal('0'); + // Press pageUp key + await Page.pageUp(); + await Page.delay(1000); + // VirtualList is not scrolled and scroll thumb is not moved + expect(await Page.getScrollThumbPosition()).to.equal('0'); + }); + }); }); From f3ba7efbafcf9990733a6bab6d2a5a17b0bdc1ef Mon Sep 17 00:00:00 2001 From: Jiye Kim Date: Thu, 18 Apr 2024 10:48:14 +0900 Subject: [PATCH 6/6] add comments for scroller ui test Enact-DCO-1.0-Signed-off-by: Jiye Kim (jiye.kim@lge.com) --- .../specs/Scroller/Scroller-nativeScroll-specs.js | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/tests/ui/specs/Scroller/Scroller-nativeScroll-specs.js b/tests/ui/specs/Scroller/Scroller-nativeScroll-specs.js index 309054824b..7e0e566b91 100644 --- a/tests/ui/specs/Scroller/Scroller-nativeScroll-specs.js +++ b/tests/ui/specs/Scroller/Scroller-nativeScroll-specs.js @@ -301,27 +301,38 @@ describe('Scroller', function () { }); describe('Page Scroll', function () { - it('should scroll with pressed pageUp/Down key only when pointer is in the Scroller.', async function () { + it('should scroll with pressed pageUp/Down key only when focus is in the Scroller.', async function () { await ScrollerPage.open(); let verticalScrollTumbPosition = (await ScrollerPage.getScrollThumbPosition()).vertical; + // Scroll thumb is on the initial position expect(await verticalScrollTumbPosition).to.equal('0'); + // Move focus to Scroller await ScrollerPage.scroller.moveTo(); + // Scroll by pageDown key await ScrollerPage.pageDown(); await ScrollerPage.delay(1000); verticalScrollTumbPosition = (await ScrollerPage.getScrollThumbPosition()).vertical; + // Scroller is scrolled and scroll thumb is moved expect(await verticalScrollTumbPosition).not.to.equal('0'); + // Scroll by pageUp key await ScrollerPage.pageUp(); await ScrollerPage.delay(1000); verticalScrollTumbPosition = (await ScrollerPage.getScrollThumbPosition()).vertical; + // Scroller is scrolled and scroll thumb is moved to initial position expect(await verticalScrollTumbPosition).to.equal('0'); + // Move focus to buttonHideScrollbar await ScrollerPage.buttonHideScrollbar.moveTo(); + // Press pageDown key await ScrollerPage.pageDown(); await ScrollerPage.delay(1000); verticalScrollTumbPosition = (await ScrollerPage.getScrollThumbPosition()).vertical; + // Scroller is not scrolled and scroll thumb is not moved expect(await verticalScrollTumbPosition).to.equal('0'); + // Press pageUp key await ScrollerPage.pageUp(); await ScrollerPage.delay(1000); verticalScrollTumbPosition = (await ScrollerPage.getScrollThumbPosition()).vertical; + // Scroller is not scrolled and scroll thumb is not moved expect(await verticalScrollTumbPosition).to.equal('0'); }); });