Skip to content

Commit

Permalink
Form Block: Makese the button an element button
Browse files Browse the repository at this point in the history
  • Loading branch information
scruffian committed May 23, 2022
1 parent 20f6ca5 commit 1d4c945
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 3 deletions.
6 changes: 5 additions & 1 deletion packages/block-library/src/file/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import {
RichText,
useBlockProps,
store as blockEditorStore,
__experimentalElementButtonClassName,
} from '@wordpress/block-editor';
import { useEffect } from '@wordpress/element';
import { useCopyToClipboard } from '@wordpress/compose';
Expand Down Expand Up @@ -301,7 +302,10 @@ function FileEdit( {
<RichText
tagName="div" // Must be block-level or else cursor disappears.
aria-label={ __( 'Download button text' ) }
className={ 'wp-block-file__button' }
className={ classnames(
'wp-block-file__button',
__experimentalElementButtonClassName
) }
value={ downloadButtonText }
withoutInteractiveFormatting
placeholder={ __( 'Add text…' ) }
Expand Down
16 changes: 14 additions & 2 deletions packages/block-library/src/file/save.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,16 @@
/**
* External dependencies
*/
import classnames from 'classnames';

/**
* WordPress dependencies
*/
import { RichText, useBlockProps } from '@wordpress/block-editor';
import {
RichText,
useBlockProps,
__experimentalElementButtonClassName,
} from '@wordpress/block-editor';
import { __, sprintf } from '@wordpress/i18n';

export default function save( { attributes } ) {
Expand Down Expand Up @@ -63,7 +72,10 @@ export default function save( { attributes } ) {
{ showDownloadButton && (
<a
href={ href }
className="wp-block-file__button"
className={ classnames(
'wp-block-file__button',
__experimentalElementButtonClassName
) }
download={ true }
aria-describedby={ describedById }
>
Expand Down

0 comments on commit 1d4c945

Please sign in to comment.