Skip to content

Commit 6985f08

Browse files
Infinite-NullInfinite-Nullt-hamanocarolinanjoedolson
authored
Navigation Link, Navigation Submenu: Remove the title attribute controls (#69689)
* Remove Title attribute controls * Remove Title controls from Image component * Remove 'title' attribute from navigation link and submenu blocks * Remove title attribute checks from custom sources tests * Revert image changes * Remove `title` attribute from navigation link and submenu blocks Co-authored-by: Infinite-Null <ankitkumarshah@git.wordpress.org> Co-authored-by: t-hamano <wildworks@git.wordpress.org> Co-authored-by: carolinan <poena@git.wordpress.org> Co-authored-by: joedolson <joedolson@git.wordpress.org>
1 parent cf99725 commit 6985f08

File tree

9 files changed

+5
-65
lines changed

9 files changed

+5
-65
lines changed

docs/reference-guides/core-blocks.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -484,7 +484,7 @@ Add a page, link, or another item to your navigation. ([Source](https://github.c
484484
- **Parent:** core/navigation
485485
- **Allowed Blocks:** core/navigation-link, core/navigation-submenu, core/page-list
486486
- **Supports:** interactivity (clientNavigation), typography (fontSize, lineHeight), ~~html~~, ~~renaming~~, ~~reusable~~
487-
- **Attributes:** description, id, isTopLevelLink, kind, label, opensInNewTab, rel, title, type, url
487+
- **Attributes:** description, id, isTopLevelLink, kind, label, opensInNewTab, rel, type, url
488488

489489
## Submenu
490490

@@ -494,7 +494,7 @@ Add a submenu to your navigation. ([Source](https://github.com/WordPress/gutenbe
494494
- **Category:** design
495495
- **Parent:** core/navigation
496496
- **Supports:** interactivity (clientNavigation), typography (fontSize, lineHeight), ~~html~~, ~~reusable~~
497-
- **Attributes:** description, id, isTopLevelItem, kind, label, opensInNewTab, rel, title, type, url
497+
- **Attributes:** description, id, isTopLevelItem, kind, label, opensInNewTab, rel, type, url
498498

499499
## Page Break
500500

packages/block-library/src/navigation-link/block.json

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,6 @@
3535
"url": {
3636
"type": "string"
3737
},
38-
"title": {
39-
"type": "string"
40-
},
4138
"kind": {
4239
"type": "string"
4340
},

packages/block-library/src/navigation-link/edit.js

Lines changed: 1 addition & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ function getMissingText( type ) {
174174
* Consider reusing this components for both blocks.
175175
*/
176176
function Controls( { attributes, setAttributes, setIsLabelFieldFocused } ) {
177-
const { label, url, description, title, rel } = attributes;
177+
const { label, url, description, rel } = attributes;
178178
return (
179179
<ToolsPanel label={ __( 'Settings' ) }>
180180
<ToolsPanelItem
@@ -239,27 +239,6 @@ function Controls( { attributes, setAttributes, setIsLabelFieldFocused } ) {
239239
/>
240240
</ToolsPanelItem>
241241

242-
<ToolsPanelItem
243-
hasValue={ () => !! title }
244-
label={ __( 'Title attribute' ) }
245-
onDeselect={ () => setAttributes( { title: '' } ) }
246-
isShownByDefault
247-
>
248-
<TextControl
249-
__nextHasNoMarginBottom
250-
__next40pxDefaultSize
251-
label={ __( 'Title attribute' ) }
252-
value={ title || '' }
253-
onChange={ ( titleValue ) => {
254-
setAttributes( { title: titleValue } );
255-
} }
256-
autoComplete="off"
257-
help={ __(
258-
'Additional information to help clarify the purpose of the link.'
259-
) }
260-
/>
261-
</ToolsPanelItem>
262-
263242
<ToolsPanelItem
264243
hasValue={ () => !! rel }
265244
label={ __( 'Rel attribute' ) }

packages/block-library/src/navigation-link/index.php

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -249,10 +249,6 @@ function render_block_core_navigation_link( $attributes, $content, $block ) {
249249
$html .= ' rel="nofollow"';
250250
}
251251

252-
if ( isset( $attributes['title'] ) ) {
253-
$html .= ' title="' . esc_attr( $attributes['title'] ) . '"';
254-
}
255-
256252
// End appending HTML attributes to anchor tag.
257253

258254
// Start anchor tag content.

packages/block-library/src/navigation-link/transforms.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,13 +115,12 @@ const transforms = {
115115
{
116116
type: 'block',
117117
blocks: [ 'core/buttons' ],
118-
transform: ( { label, url, rel, title, opensInNewTab } ) => {
118+
transform: ( { label, url, rel, opensInNewTab } ) => {
119119
return createBlock( 'core/buttons', {}, [
120120
createBlock( 'core/button', {
121121
text: label,
122122
url,
123123
rel,
124-
title,
125124
linkTarget: opensInNewTab ? '_blank' : undefined,
126125
} ),
127126
] );

packages/block-library/src/navigation-link/update-attributes.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ import { safeDecodeURI } from '@wordpress/url';
1919
* @property {number} [id] A post or term id.
2020
* @property {boolean} [opensInNewTab] Sets link target to _blank when true.
2121
* @property {string} [url] Link href.
22-
* @property {string} [title] Link title attribute.
2322
*/
2423
/**
2524
* Link Control onChange handler that updates block attributes when a setting is changed.

packages/block-library/src/navigation-submenu/block.json

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,6 @@
3030
"url": {
3131
"type": "string"
3232
},
33-
"title": {
34-
"type": "string"
35-
},
3633
"kind": {
3734
"type": "string"
3835
},

packages/block-library/src/navigation-submenu/edit.js

Lines changed: 1 addition & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,6 @@ const useIsDraggingWithin = ( elementRef ) => {
123123
* @property {number} [id] A post or term id.
124124
* @property {boolean} [opensInNewTab] Sets link target to _blank when true.
125125
* @property {string} [url] Link href.
126-
* @property {string} [title] Link title attribute.
127126
*/
128127

129128
export default function NavigationSubmenuEdit( {
@@ -135,7 +134,7 @@ export default function NavigationSubmenuEdit( {
135134
context,
136135
clientId,
137136
} ) {
138-
const { label, url, description, rel, title } = attributes;
137+
const { label, url, description, rel } = attributes;
139138

140139
const { showSubmenuIcon, maxNestingLevel, openSubmenusOnClick } = context;
141140

@@ -392,7 +391,6 @@ export default function NavigationSubmenuEdit( {
392391
label: '',
393392
url: '',
394393
description: '',
395-
title: '',
396394
rel: '',
397395
} );
398396
} }
@@ -458,27 +456,6 @@ export default function NavigationSubmenuEdit( {
458456
/>
459457
</ToolsPanelItem>
460458

461-
<ToolsPanelItem
462-
label={ __( 'Title attribute' ) }
463-
isShownByDefault
464-
hasValue={ () => !! title }
465-
onDeselect={ () => setAttributes( { title: '' } ) }
466-
>
467-
<TextControl
468-
__nextHasNoMarginBottom
469-
__next40pxDefaultSize
470-
value={ title || '' }
471-
onChange={ ( titleValue ) => {
472-
setAttributes( { title: titleValue } );
473-
} }
474-
label={ __( 'Title attribute' ) }
475-
autoComplete="off"
476-
help={ __(
477-
'Additional information to help clarify the purpose of the link.'
478-
) }
479-
/>
480-
</ToolsPanelItem>
481-
482459
<ToolsPanelItem
483460
label={ __( 'Rel attribute' ) }
484461
isShownByDefault

packages/block-library/src/navigation-submenu/index.php

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -169,10 +169,6 @@ function render_block_core_navigation_submenu( $attributes, $content, $block ) {
169169
$html .= ' rel="nofollow"';
170170
}
171171

172-
if ( isset( $attributes['title'] ) ) {
173-
$html .= ' title="' . esc_attr( $attributes['title'] ) . '"';
174-
}
175-
176172
$html .= '>';
177173
// End appending HTML attributes to anchor tag.
178174

0 commit comments

Comments
 (0)