-
Notifications
You must be signed in to change notification settings - Fork 6.8k
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
fix(ripple): Fix the ripple position #1907
Conversation
let top = 75; | ||
|
||
// Add a very large element to make the page scroll | ||
let veryLargeElement: HTMLElement = document.createElement('div'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You don't need the type here; document.createElement('div');
will return an HTMLDivElement
(typescript understands string literals in its type system so it can know things like document.createElement
or addEventListener
can have different arguments based on the string based to them)
document.body.scrollLeft = pageScrollLeft; | ||
|
||
rippleElement.style.left = `${elementLeft}px`; | ||
rippleElement.style.top = `${elementTop}px`; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Setting the
left
andtop
of the rippleElement probably won't do what you want if the element isn'tposition: absolute
. - I'm not sure if the rippleElement is in the DOM; it would have to be for the positioning to be right.
This might be why the tests are failing.
document.body.scrollTop || 0; | ||
var scrollLeft = window.pageXOffset || document.documentElement.scrollLeft || | ||
document.body.scrollLeft || 0; | ||
this.end(event.pageX - scrollLeft, event.pageY - scrollTop, isKeyEvent); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you use ViewportRuler.getViewportScrollPosition
for this?
955dd77
to
5419d13
Compare
Tests fixed. PTAL. Thanks! |
@tinayuangao can you rebase this PR? |
5419d13
to
243d086
Compare
c8dc081
to
53b4f6c
Compare
Rebased and fixed the test. |
-documentRect.left : | ||
document.body.scrollLeft; | ||
const top = -documentRect.top || document.body.scrollTop || window.scrollY || 0; | ||
const left = -documentRect.left || document.body.scrollLeft || window.scrollX || 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What was your reason for changing this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The mobile safari/IE test will fail without the window.scrollX/Y case.
@@ -210,3 +214,15 @@ class TestApp { | |||
this.clickCount++; | |||
} | |||
} | |||
|
|||
class FakeViewportRuler { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we move this to its own file instead of duplicating it? Having fake-viewport-ruler.ts
under overlay/position
would work.
LGTM |
Please add |
68dfd0e
to
ea88d34
Compare
Done. Added |
32bcde6
to
b01a0d1
Compare
Tested this on IE11, Mobile Safari (9), and Firefox and everything seemed good. |
@mmalerba I rebased this and updated the PR |
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
When scroll down the page, the ripple position is off
Closes #1817
Original PR #1820 is accidentally closed.
R: @kara @jelbourn