Skip to content

Commit e4b8957

Browse files
committed
Block Library: Button: Remove title attribute handling
1 parent 6aa9944 commit e4b8957

File tree

2 files changed

+10
-22
lines changed

2 files changed

+10
-22
lines changed

packages/block-library/src/button/edit.js

+6-22
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
* External dependencies
33
*/
44
import classnames from 'classnames';
5-
import { escape } from 'lodash';
65

76
/**
87
* WordPress dependencies
@@ -77,14 +76,7 @@ function BorderPanel( { borderRadius = '', setAttributes } ) {
7776
);
7877
}
7978

80-
function URLPicker( {
81-
isSelected,
82-
url,
83-
title,
84-
setAttributes,
85-
opensInNewTab,
86-
onToggleOpenInNewTab,
87-
} ) {
79+
function URLPicker( { isSelected, url, setAttributes, opensInNewTab, onToggleOpenInNewTab } ) {
8880
const [ isURLPickerOpen, setIsURLPickerOpen ] = useState( false );
8981
const openLinkControl = () => {
9082
setIsURLPickerOpen( true );
@@ -93,16 +85,9 @@ function URLPicker( {
9385
<Popover position="bottom center" onClose={ () => setIsURLPickerOpen( false ) }>
9486
<LinkControl
9587
className="wp-block-navigation-link__inline-link-input"
96-
value={ { url, title, opensInNewTab } }
97-
onChange={ ( {
98-
title: newTitle = '',
99-
url: newURL = '',
100-
opensInNewTab: newOpensInNewTab,
101-
} ) => {
102-
setAttributes( {
103-
title: escape( newTitle ),
104-
url: newURL,
105-
} );
88+
value={ { url, opensInNewTab } }
89+
onChange={ ( { url: newURL = '', opensInNewTab: newOpensInNewTab } ) => {
90+
setAttributes( { url: newURL } );
10691

10792
if ( opensInNewTab !== newOpensInNewTab ) {
10893
onToggleOpenInNewTab( newOpensInNewTab );
@@ -149,7 +134,7 @@ function ButtonEdit( {
149134
className,
150135
isSelected,
151136
} ) {
152-
const { borderRadius, linkTarget, placeholder, rel, text, title, url } = attributes;
137+
const { borderRadius, linkTarget, placeholder, rel, text, url } = attributes;
153138
const onSetLinkRel = useCallback(
154139
( value ) => {
155140
setAttributes( { rel: value } );
@@ -178,7 +163,7 @@ function ButtonEdit( {
178163
const { gradientClass, gradientValue, setGradient } = __experimentalUseGradient();
179164

180165
return (
181-
<div className={ className } title={ title }>
166+
<div className={ className }>
182167
<RichText
183168
placeholder={ placeholder || __( 'Add text…' ) }
184169
value={ text }
@@ -201,7 +186,6 @@ function ButtonEdit( {
201186
} }
202187
/>
203188
<URLPicker
204-
title={ title }
205189
url={ url }
206190
setAttributes={ setAttributes }
207191
isSelected={ isSelected }

packages/block-library/src/button/save.js

+4
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,10 @@ export default function save( { attributes } ) {
5050
borderRadius: borderRadius ? borderRadius + 'px' : undefined,
5151
};
5252

53+
// The use of a `title` attribute here is soft-deprecated, but still applied
54+
// if it had already been assigned, for the sake of backward-compatibility.
55+
// A title will no longer be assigned for new or updated button block links.
56+
5357
return (
5458
<div>
5559
<RichText.Content

0 commit comments

Comments
 (0)