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

MDC-Slider in MDC-dialog thumb container positioning #1017

Open
JordyvA opened this issue Jul 26, 2017 · 8 comments
Open

MDC-Slider in MDC-dialog thumb container positioning #1017

JordyvA opened this issue Jul 26, 2017 · 8 comments
Labels

Comments

@JordyvA
Copy link

JordyvA commented Jul 26, 2017

Hi all,

I've a problem with the MDC-slider inside a MDC-dialog. The slider is not positioning on the right spot because of the MDC-dialog I think. The width of the complete slider with the track markers is right. The only thing is that the thumb is not on the right markers. The situation:

| = marker

  • = slider
    0 = thumb

|------------------------------0------|-------------------------------------| (On position 1 - first par of bar is colored)

|-------------------------------------|----------------------0--------------| (On position 2 - bar is fully colored)

When I resize the window a little, the slider thumbs are correct on top of the markers. Is it possible that the slider keeps track of the parent as well? So when the parent is resizing (dialog), the thumbs are replaced as well? If I use a setTimeout after showing the dialog, and creating the slider inside that timeout, it's working well.

@yeelan0319
Copy link
Contributor

Hi @jordyboytjuh , could you provide a codepen to reproduce this bug so that we can better nail it down? Thanks!

@yeelan0319 yeelan0319 self-assigned this Jul 31, 2017
@JordyvA
Copy link
Author

JordyvA commented Aug 1, 2017

Hi @yeelan0319 , Thanks for the response. I've made a codepen of the issue. The thumbs are not placed on the right position on init. After resizing the window, the thumbs are fixed again.

https://codepen.io/anon/pen/BYLXEp

@JordyvA
Copy link
Author

JordyvA commented Aug 7, 2017

Something new on this issue? @yeelan0319

@evgeniysharapov
Copy link

I have the same issue and I can attest to the fact that resizing the window fixes discrete slider in the dialog.

@danielweck
Copy link

danielweck commented Oct 27, 2017

Same problem inside mdc-temporary-drawer, except resizing the window in order to fix this is not an option. UPDATE: resizing the does in fact fix the slider's thumb, which is otherwise totally stuck on one side when inside a drawer.

@danielweck
Copy link

I updated my comment above, as resizing the window does in fact help.

@danielweck
Copy link

I solved this by invoking slider.layout() in an MDCTemporaryDrawer:open event callback.

@sbryan
Copy link

sbryan commented May 24, 2019

FYI, found another use case where this marker/thumb/track is not properly rendered if it's container is not initially shown (The <details/> contents slot defaults to display: none until/unless it is "open".

Here's a Stackblitz project that demonstrates the issue when used inside <details/> elements.

As noted by others above, resizing the window/view seems to fix the problem. While there are workarounds (manually invoke the sliders layout() method, this is still a bug since there are now at least 3 reasonable and common use cases that reliably reproduce the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

6 participants