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

Bug: Fix Button JS Rendered Event Emitted + Update Button JS Demo #924

Merged
merged 2 commits into from
Oct 23, 2018

Conversation

sghoweri
Copy link
Contributor

@sghoweri sghoweri commented Oct 23, 2018

Jira

http://vjira2:8080/browse/BDS-728

Details

Fixes the Bolt button component's JS logic so the ready and rendered JavaScript events —recently added to the globally shared Bolt base component in v2.x when a component renders initially + re-renders, respectfully— fires as expected.

Note: a recent update made to improve the cross-browser rendering of dynamically injected buttons caused this event to stop working as expected (forgot to call super.rendered(), however it's worth mentioning that given the virtually undocumented nature of this update and how the how this feature was only just recently added, it's incredibly unlikely this update was getting used downstream just yet.

For reference, these events were added in the v2.x release as a possible new pattern to help with consistently binding / rebinding 3rd party JavaScript to a Bolt component in a number of different use cases and situations:

  • Binding to a component that hasn't yet finished rendering (either based on the order JavaScript runs and/or if the component is async loaded)
  • Binding to a component that renders differently based on browser support (natively supporting Shadow DOM vs non-Shadow DOM rendering)
  • Binding to a component that automatically renders differently based on the context it's getting used (ex. components used in forms automatically never render to the Shadow DOM since Bolt v1.x)
  • Binding to a component which, based on data, state, DOM mutations, and lifecycle event changes, re-renders

How to test

  • Check out the existing button JS demo in Pattern Lab and confirm the console logged event + theme toggle work as expected.

CC @charginghawk and @krlucas

@bolt-bot
Copy link
Collaborator

⚡ PR built on Travis and deployed a now preview here:

@remydenton remydenton mentioned this pull request Oct 23, 2018
@sghoweri sghoweri mentioned this pull request Oct 23, 2018
@sghoweri sghoweri merged commit eb97357 into master Oct 23, 2018
@sghoweri sghoweri deleted the hotfix/fix-button-JS-event-demo branch October 24, 2018 11:27
This was referenced Nov 18, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants