Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Change aria-label depending on content of paragraph block #11653

Merged
merged 2 commits into from
Nov 9, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/design/block-design.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ The most basic unit of the editor. The paragraph block is a simple input field.

### Placeholder:

- Simple placeholder text that reads “Start writing or press / to insert a block”. The placeholder disappears when the block is selected.
- Simple placeholder text that reads “Start writing or type / to choose a block”. The placeholder disappears when the block is selected.

### Selected state:

Expand Down
2 changes: 1 addition & 1 deletion lib/client-assets.php
Original file line number Diff line number Diff line change
Expand Up @@ -1621,7 +1621,7 @@ function gutenberg_editor_scripts_and_styles( $hook ) {
'disableCustomFontSizes' => get_theme_support( 'disable-custom-font-sizes' ),
'disablePostFormats' => ! current_theme_supports( 'post-formats' ),
'titlePlaceholder' => apply_filters( 'enter_title_here', __( 'Add title', 'gutenberg' ), $post ),
'bodyPlaceholder' => apply_filters( 'write_your_story', __( 'Start writing or press / to insert a block', 'gutenberg' ), $post ),
'bodyPlaceholder' => apply_filters( 'write_your_story', __( 'Start writing or type / to choose a block', 'gutenberg' ), $post ),
'isRTL' => is_rtl(),
'autosaveInterval' => 10,
'maxUploadFileSize' => $max_upload_size,
Expand Down
4 changes: 2 additions & 2 deletions packages/block-library/src/paragraph/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -245,8 +245,8 @@ class ParagraphBlock extends Component {
onMerge={ mergeBlocks }
onReplace={ this.onReplace }
onRemove={ () => onReplace( [] ) }
aria-label={ __( 'Empty block; type text or press the forward slash key to insert a block' ) }
placeholder={ placeholder || __( 'Start writing or press / to insert a block' ) }
aria-label={ content ? __( 'Paragraph block' ) : __( 'Empty block; start writing or type forward slash to choose a block' ) }
placeholder={ placeholder || __( 'Start writing or type / to choose a block' ) }
/>
</Fragment>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ exports[`core/paragraph block edit matches snapshot 1`] = `
<p
aria-autocomplete="list"
aria-expanded="false"
aria-label="Empty block; type text or press the forward slash key to insert a block"
aria-label="Empty block; start writing or type forward slash to choose a block"
aria-multiline="true"
class="wp-block-paragraph editor-rich-text__tinymce"
contenteditable="true"
Expand All @@ -28,7 +28,7 @@ exports[`core/paragraph block edit matches snapshot 1`] = `
<p
class="editor-rich-text__tinymce wp-block-paragraph"
>
Start writing or press / to insert a block
Start writing or type / to choose a block
</p>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export function DefaultBlockAppender( {
return null;
}

const value = decodeEntities( placeholder ) || __( 'Start writing or press / to insert a block' );
const value = decodeEntities( placeholder ) || __( 'Start writing or type / to choose a block' );

// The appender "button" is in-fact a text field so as to support
// transitions by WritingFlow occurring by arrow key press. WritingFlow
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ exports[`DefaultBlockAppender should append a default block when input focused 1
readOnly={true}
role="button"
type="text"
value="Start writing or press / to insert a block"
value="Start writing or type / to choose a block"
/>
<WithSelect(WithDispatch(InserterWithShortcuts)) />
<WithSelect(IfCondition(Inserter))
Expand All @@ -42,7 +42,7 @@ exports[`DefaultBlockAppender should match snapshot 1`] = `
readOnly={true}
role="button"
type="text"
value="Start writing or press / to insert a block"
value="Start writing or type / to choose a block"
/>
<WithSelect(WithDispatch(InserterWithShortcuts)) />
<WithSelect(IfCondition(Inserter))
Expand Down