diff --git a/packages/block-library/src/button/block.json b/packages/block-library/src/button/block.json index 28c72d4d22ab0..eec327b4ca48e 100644 --- a/packages/block-library/src/button/block.json +++ b/packages/block-library/src/button/block.json @@ -11,6 +11,7 @@ "attributes": { "tagName": { "type": "string", + "enum": [ "a", "button" ], "default": "a" }, "type": { diff --git a/packages/block-library/src/button/edit.js b/packages/block-library/src/button/edit.js index a6c9c035e5bc1..0c1892c6e4c70 100644 --- a/packages/block-library/src/button/edit.js +++ b/packages/block-library/src/button/edit.js @@ -139,6 +139,7 @@ function ButtonEdit( props ) { const [ isEditingURL, setIsEditingURL ] = useState( false ); const isURLSet = !! url; const opensInNewTab = linkTarget === '_blank'; + const isLinkTag = 'a' === TagName; function startEditing( event ) { event.preventDefault(); @@ -220,7 +221,7 @@ function ButtonEdit( props ) { setAttributes( { textAlign: nextAlign } ); } } /> - { ! isURLSet && 'a' === TagName && ( + { ! isURLSet && isLinkTag && ( ) } - { isURLSet && 'a' === TagName && ( + { isURLSet && isLinkTag && ( ) } - { 'a' === TagName && isSelected && ( isEditingURL || isURLSet ) && ( + { isLinkTag && isSelected && ( isEditingURL || isURLSet ) && ( { @@ -279,7 +280,7 @@ function ButtonEdit( props ) { /> - { 'a' === TagName && ( + { isLinkTag && ( );