Skip to content

Commit

Permalink
feedback: fix last link was greyed out issue when scrolled to the end
Browse files Browse the repository at this point in the history
On search page and confirmation page, when docked magnifier is on and
when scrolled to the bottom, the last item is greyed out [1,2], although it is still clickable.

Debugging found the scrollTop reading on those page was off by 0.61 px
when the content was scrolled to bottom. This caused the shadowShield
be still visible even though it should not be.

Change the scrolling ended condition from:

scrollTop + clientHeight == scrollHeight

To: scrollTop + clientHeight + 1 >= scrollHeight

This fixed the issue [3,4].

Screenshots:

1. Before: http://screen/B4rbfA353dvt2Dm.png.
2. Before: http://screen/7zu6srogQzJWwxk.png.
3. After:  http://screen/AuXhVyT9p2yDAU5.png.
4. After:  http://screen/82qc6y3GCcX4hgS.png.

Bug: b:262607823, b:185624798
Test: manually tested on DUT and VM.
Change-Id: Idaa43b23179d25b92d94a84ef2b898a02951194f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4112619
Commit-Queue: Xiangdong Kong <xiangdongkong@google.com>
Reviewed-by: Ashley Prasad <ashleydp@google.com>
Cr-Commit-Position: refs/heads/main@{#1084641}
  • Loading branch information
xiangdong kong authored and Chromium LUCI CQ committed Dec 17, 2022
1 parent 16468c1 commit 202b765
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions ash/webui/os_feedback_ui/resources/feedback_utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,19 @@ export function showScrollingEffects(event, page) {
const shadowElevation = page.shadowRoot.querySelector('#shadowElevation');
const separator = page.shadowRoot.querySelector('#separator');

// Debugging found the scrollTop reading sometimes was off by 0.61 px when the
// content was scrolled to bottom. This caused the shadowShield be still
// visible even though it should not be. Relax the condition to be not larger
// than 1 px.
const scrollingEnded =
(content.scrollTop + content.clientHeight + 1 >= content.scrollHeight);

shadowElevation.classList.toggle(
'elevation-shadow-scrolling', content.scrollTop > 0);
navButtons.classList.toggle('nav-buttons-scrolling', content.scrollTop > 0);
shadowShield.classList.toggle(
'scrolling-shield',
content.scrollTop + content.clientHeight < content.scrollHeight);
shadowShield.classList.toggle('scrolling-shield', !scrollingEnded);
separator.classList.toggle(
'separator-scrolling-end',
content.scrollTop + content.clientHeight == content.scrollHeight &&
content.scrollTop > 0);
'separator-scrolling-end', scrollingEnded && content.scrollTop > 0);
}

/**
Expand Down

0 comments on commit 202b765

Please sign in to comment.