Skip to content

Button Block: Only display buttons if the title attribute exists  #17221

@richtabor

Description

@richtabor

Describe the bug
Currently, a Button block without a title attribute still renders an empty button via the save function, leaving an empty <a> on the page.

To reproduce
Steps to reproduce the behavior:

  1. Add an empty Button block
  2. Publish the page
  3. View the published page
  4. See error

Expected behavior
A button is not rendered unless the title attribute is entered, preventing empty buttons from displaying if it's not intentionally configured within the editor.

Screenshots
If applicable, add screenshots to help explain your problem.
ScreenFlow

Desktop (please complete the following information):

  • OS: MacOS
  • Browser: Safari
  • Version: 12.1.1

Additional context
Using Gutenberg 6.3, although it happens regardless of whether or not the plugin is active.

Metadata

Metadata

Labels

[Block] ButtonsAffects the Buttons Block[Status] In ProgressTracking issues with work in progress[Type] BugAn existing feature does not function as intended

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions