Skip to content

Commit

Permalink
Block Library: Button: Remove title attribute handling
Browse files Browse the repository at this point in the history
  • Loading branch information
aduth committed Jan 31, 2020
1 parent 6aa9944 commit e4b8957
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 22 deletions.
28 changes: 6 additions & 22 deletions packages/block-library/src/button/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
* External dependencies
*/
import classnames from 'classnames';
import { escape } from 'lodash';

/**
* WordPress dependencies
Expand Down Expand Up @@ -77,14 +76,7 @@ function BorderPanel( { borderRadius = '', setAttributes } ) {
);
}

function URLPicker( {
isSelected,
url,
title,
setAttributes,
opensInNewTab,
onToggleOpenInNewTab,
} ) {
function URLPicker( { isSelected, url, setAttributes, opensInNewTab, onToggleOpenInNewTab } ) {
const [ isURLPickerOpen, setIsURLPickerOpen ] = useState( false );
const openLinkControl = () => {
setIsURLPickerOpen( true );
Expand All @@ -93,16 +85,9 @@ function URLPicker( {
<Popover position="bottom center" onClose={ () => setIsURLPickerOpen( false ) }>
<LinkControl
className="wp-block-navigation-link__inline-link-input"
value={ { url, title, opensInNewTab } }
onChange={ ( {
title: newTitle = '',
url: newURL = '',
opensInNewTab: newOpensInNewTab,
} ) => {
setAttributes( {
title: escape( newTitle ),
url: newURL,
} );
value={ { url, opensInNewTab } }
onChange={ ( { url: newURL = '', opensInNewTab: newOpensInNewTab } ) => {
setAttributes( { url: newURL } );

if ( opensInNewTab !== newOpensInNewTab ) {
onToggleOpenInNewTab( newOpensInNewTab );
Expand Down Expand Up @@ -149,7 +134,7 @@ function ButtonEdit( {
className,
isSelected,
} ) {
const { borderRadius, linkTarget, placeholder, rel, text, title, url } = attributes;
const { borderRadius, linkTarget, placeholder, rel, text, url } = attributes;
const onSetLinkRel = useCallback(
( value ) => {
setAttributes( { rel: value } );
Expand Down Expand Up @@ -178,7 +163,7 @@ function ButtonEdit( {
const { gradientClass, gradientValue, setGradient } = __experimentalUseGradient();

return (
<div className={ className } title={ title }>
<div className={ className }>
<RichText
placeholder={ placeholder || __( 'Add text…' ) }
value={ text }
Expand All @@ -201,7 +186,6 @@ function ButtonEdit( {
} }
/>
<URLPicker
title={ title }
url={ url }
setAttributes={ setAttributes }
isSelected={ isSelected }
Expand Down
4 changes: 4 additions & 0 deletions packages/block-library/src/button/save.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,10 @@ export default function save( { attributes } ) {
borderRadius: borderRadius ? borderRadius + 'px' : undefined,
};

// The use of a `title` attribute here is soft-deprecated, but still applied
// if it had already been assigned, for the sake of backward-compatibility.
// A title will no longer be assigned for new or updated button block links.

return (
<div>
<RichText.Content
Expand Down

0 comments on commit e4b8957

Please sign in to comment.