Skip to content

Commit dfbda26

Browse files
ramonjdyouknowriad
authored andcommitted
DotTip: Rename id attribute to tipId (#10317)
* Resolves #10305 by renaming `id` prop on `<DotTip />` to `tipId` to avoid using common DOM attributes as prop names. Updates prop names where we're using the component, including in README examples and documentation. Updates related unit tests and snapshot. Removes eslint exception. * Add deprecation
1 parent a8ff105 commit dfbda26

File tree

14 files changed

+35
-19
lines changed

14 files changed

+35
-19
lines changed

.eslintrc.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -155,10 +155,7 @@ module.exports = {
155155
message: 'Prefer page.waitForSelector instead.',
156156
},
157157
{
158-
// The <DotTip> component uses the `id` prop for something that does not require an
159-
// instanceId; maybe we should change its key.
160-
// See: https://github.com/WordPress/gutenberg/issues/10305
161-
selector: 'JSXOpeningElement[name.name!="DotTip"] JSXAttribute[name.name="id"][value.type="Literal"]',
158+
selector: 'JSXAttribute[name.name="id"][value.type="Literal"]',
162159
message: 'Do not use string literals for IDs; use withInstanceId instead.',
163160
},
164161
{

docs/reference/deprecated.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ Gutenberg's deprecation policy is intended to support backwards-compatibility fo
55
- `wp.date.getSettings` has been removed. Please use `wp.date.__experimentalGetSettings` instead.
66
- `wp.compose.remountOnPropChange` has been removed.
77
- The following editor store actions have been removed: `createNotice`, `removeNotice`, `createSuccessNotice`, `createInfoNotice`, `createErrorNotice`, `createWarningNotice`. Use the equivalent actions by the same name from the `@wordpress/notices` module.
8+
- The id prop of wp.nux.DotTip has been removed. Please use the tipId prop instead.
89

910
## 4.3.0
1011

lib/client-assets.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -550,6 +550,7 @@ function gutenberg_register_scripts_and_styles() {
550550
'wp-components',
551551
'wp-compose',
552552
'wp-data',
553+
'wp-deprecated',
553554
'wp-i18n',
554555
'wp-polyfill',
555556
'lodash',

package-lock.json

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/edit-post/src/components/header/header-toolbar/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ function HeaderToolbar( { hasFixedToolbar, isLargeViewport, mode } ) {
3030
<FullscreenModeClose />
3131
<div>
3232
<Inserter disabled={ mode !== 'visual' } position="bottom right" />
33-
<DotTip id="core/editor.inserter">
33+
<DotTip tipId="core/editor.inserter">
3434
{ __( 'Welcome to the wonderful world of blocks! Click the “+” (“Add block”) button to add a new block. There are blocks available for all kinds of content: you can insert text, headings, images, lists, and lots more!' ) }
3535
</DotTip>
3636
</div>

packages/edit-post/src/components/header/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ function Header( {
5959
aria-expanded={ isEditorSidebarOpened }
6060
shortcut={ shortcuts.toggleSidebar }
6161
/>
62-
<DotTip id="core/editor.settings">
62+
<DotTip tipId="core/editor.settings">
6363
{ __( 'You’ll find more settings for your page and blocks in the sidebar. Click “Settings” to open it.' ) }
6464
</DotTip>
6565
</div>

packages/editor/src/components/post-preview-button/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ export class PostPreviewButton extends Component {
167167
disabled={ ! isSaveable }
168168
>
169169
{ _x( 'Preview', 'imperative verb' ) }
170-
<DotTip id="core/editor.preview">
170+
<DotTip tipId="core/editor.preview">
171171
{ __( 'Click “Preview” to load a preview of this page, so you can make sure you’re happy with your blocks.' ) }
172172
</DotTip>
173173
</Button>

packages/editor/src/components/post-preview-button/test/__snapshots__/index.js.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ exports[`PostPreviewButton render() should match the snapshot 1`] = `
99
>
1010
Preview
1111
<WithSelect(WithDispatch(DotTip))
12-
id="core/editor.preview"
12+
tipId="core/editor.preview"
1313
>
1414
Click “Preview” to load a preview of this page, so you can make sure you’re happy with your blocks.
1515
</WithSelect(WithDispatch(DotTip))>

packages/editor/src/components/post-publish-panel/toggle.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ export function PostPublishPanelToggle( {
3131
isBusy={ isSaving && isPublished }
3232
>
3333
{ isBeingScheduled ? __( 'Schedule…' ) : __( 'Publish…' ) }
34-
<DotTip id="core/editor.publish">
34+
<DotTip tipId="core/editor.publish">
3535
{ __( 'Finished writing? That’s great, let’s get this published right now. Just click “Publish” and you’re good to go.' ) }
3636
</DotTip>
3737
</Button>

packages/nux/CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
## 2.0.7 (Unreleased)
2+
3+
### Deprecations
4+
5+
- The id prop of DotTip has been deprecated. Please use the tipId prop instead.
6+
17
## 2.0.6 (2018-10-22)
28

39
## 2.0.5 (2018-10-19)

0 commit comments

Comments
 (0)