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

fix(vwc-slider): issue #789 fixing the slider miscalc when rendered in display none or resized #791

Merged
merged 7 commits into from
Apr 21, 2021

Conversation

gullerya
Copy link
Contributor

@gullerya gullerya commented Apr 20, 2021

closes #789

The issue self is on the MWC side, and there is an issue opened on the same malfunction here.

I've provided here a local solution based on ResizeObserver, until MWC team will resolve it on their side.

@gullerya gullerya added the Type: Bug 🐞 Something isn't working label Apr 20, 2021
@github-actions
Copy link

🚀

Latest successful build of the PR deployed here.

🚀

@@ -37,3 +37,16 @@ export function assert(condition: unknown, msg?: string): asserts condition {
throw new Error(msg);
}
}

/* eslint-disable @typescript-eslint/no-explicit-any */
export function debounce(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good fit as decorator instead of argumenting the context

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll try that out - can decorator be put on the function instead of class and still preserve this?
I'd not like to put decorator on class level with a list of methods to be decorated, but rather decorate a single method...

@yinonov
Copy link
Contributor

yinonov commented Apr 21, 2021

closes #789

The issue self is on the MWC side, and there is an issue opened on the same malfunction here.

I've provided here a local solution based on ResizeObserver, until MWC team will resolve it on their side.

Please subscribe to mwc issue to notice its closing and revert this patch

k-paxian
k-paxian previously approved these changes Apr 21, 2021
@@ -33,4 +47,9 @@ export class VWCSlider extends MWCSlider {
super.focus();
this.formElement.focus();
}

@debounced(96)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why 96?


wrapper.style.display = 'block';
assertComputedStyle(slider, { width: '120px' });
await waitInterval(160);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we use updateComplete because layout was called?
Maybe on every resize, set updateComplete to pending and call the debounced layout?

@sonarcloud
Copy link

sonarcloud bot commented Apr 21, 2021

Kudos, SonarCloud Quality Gate passed!

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@gullerya gullerya dismissed yinonov’s stale review April 21, 2021 12:02

The changes requested were implemented.

@gullerya gullerya merged commit 75e3cc9 into master Apr 21, 2021
@gullerya gullerya deleted the iss-789/viv-509-slider-init-when-hidden branch April 21, 2021 12:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ready-to-merge Type: Bug 🐞 Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[vwc-slider] inside initially closed [vwc-expansion-panel] trapped in desynchronized state
4 participants