We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
I've filed similar issues like this before, just found another example.
Basically, using getBoundingClientRect to force a repaint breaks React (and I'm presuming other things) that use Async rendering.
material-components-web/packages/mdc-tab-indicator/sliding-foundation.js
Line 51 in cffe895
My current workaround was to just not call the foundation and copy the code over. This works as expected with a RAF
activate(previousIndicatorClientRect: ClientRect) { // Early exit if no indicator is present to handle cases where an indicator // may be activated without a prior indicator state if (!previousIndicatorClientRect) { this.foundation.adapter_.addClass( MDCTabIndicatorFoundation.cssClasses.ACTIVE ); return; } const currentClientRect = this.computeContentClientRect(); const widthDelta = previousIndicatorClientRect.width / currentClientRect.width; const xPosition = previousIndicatorClientRect.left - currentClientRect.left; this.foundation.adapter_.addClass( MDCTabIndicatorFoundation.cssClasses.NO_TRANSITION ); this.foundation.adapter_.setContentStyleProperty( 'transform', `translateX(${xPosition}px) scaleX(${widthDelta})` ); // THE FIX requestAnimationFrame(() => { this.foundation.adapter_.removeClass( MDCTabIndicatorFoundation.cssClasses.NO_TRANSITION ); this.foundation.adapter_.addClass( MDCTabIndicatorFoundation.cssClasses.ACTIVE ); this.foundation.adapter_.setContentStyleProperty('transform', ''); }); }
The text was updated successfully, but these errors were encountered:
Drawer and Dialog had the same issue. Need to add rAF. Thanks James!
Sorry, something went wrong.
No branches or pull requests
I've filed similar issues like this before, just found another example.
Basically, using getBoundingClientRect to force a repaint breaks React (and I'm presuming other things) that use Async rendering.
material-components-web/packages/mdc-tab-indicator/sliding-foundation.js
Line 51 in cffe895
My current workaround was to just not call the foundation and copy the code over. This works as expected with a RAF
The text was updated successfully, but these errors were encountered: