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 incorrect nesting of buttons within a button #17342

Merged
merged 2 commits into from
Sep 6, 2019

Conversation

talldan
Copy link
Contributor

@talldan talldan commented Sep 5, 2019

Description

Fixes #9033.

The DotTip component renders buttons, so nesting it within another button was causing invalid DOM nesting. This PR makes the DotTip and the Button siblings and both children of a new parent div element. DotTip requires this parent div element to position itself in the right place.

Since #16315 (comment) proposes to remove DotTips at some point, I've left a comment to ensure the wrapping div is removed when that work is carried out.

Screenshots

Screen Shot 2019-09-05 at 5 07 55 pm

How has this been tested?

  1. Go the editor options and enable Tips.
  2. For the first three tips, click on 'See Next Tip'
  3. When the forth tip appears ('Finished Writing?'), check the console in the dev tools.
  4. Confirm that a Warning: validateDOMNesting(...): <button> cannot appear as a descendant of <button>. message does not appear in the console.

Types of changes

Bug fix (non-breaking change which fixes an issue)

Checklist:

  • My code is tested.
  • My code follows the WordPress code style.
  • My code follows the accessibility standards.
  • My code has proper inline documentation.
  • I've included developer documentation if appropriate.

@talldan talldan added [Type] Bug An existing feature does not function as intended [Feature] NUX Anything that impacts the new user experience [Package] NUX labels Sep 5, 2019
@talldan talldan self-assigned this Sep 5, 2019
Copy link
Member

@pento pento left a comment

Choose a reason for hiding this comment

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

👍🏻 This fixes the warning for me!

@talldan talldan merged commit bd45ebd into master Sep 6, 2019
@talldan talldan deleted the fix/invalid-nested-buttons-in-dom branch September 6, 2019 03:12
@youknowriad youknowriad added this to the Gutenberg 6.5 milestone Sep 14, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] NUX Anything that impacts the new user experience [Type] Bug An existing feature does not function as intended
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Editor package: invalid DOM nesting in PostPublishPanelToggle component
3 participants