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

Accessibility: Handle the iOS z-gesture to exit modals and block selection #926

Merged
merged 18 commits into from
May 23, 2019
Merged
Show file tree
Hide file tree
Changes from 15 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
1 change: 1 addition & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@

// Use 'prettier-eslint' instead of 'prettier'. Other settings will only be fallbacks in case they could not be inferred from eslint rules.
"prettier.eslintIntegration": true,
"editor.insertSpaces": false,
etoledom marked this conversation as resolved.
Show resolved Hide resolved
}
9 changes: 8 additions & 1 deletion src/block-management/block-manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ type PropsType = {
rootClientId: ?string,
blockClientIds: Array<string>,
blockCount: number,
clearSelectedBlock: () => void,
focusBlock: ( clientId: string ) => void,
selectBlock: ( clientId: string ) => void,
insertBlock: ( block: BlockType, position: number ) => void,
replaceBlock: ( string, BlockType ) => mixed,
Expand Down Expand Up @@ -253,7 +255,10 @@ export class BlockManager extends React.Component<PropsType, StateType> {

renderList() {
return (
<View style={ { flex: 1 } } >
<View
style={ { flex: 1 } }
onAccessibilityEscape={ this.props.clearSelectedBlock }
>
<KeyboardAwareFlatList
{ ...( Platform.OS === 'android' ? { removeClippedSubviews: false } : {} ) } // Disable clipping on Android to fix focus losing. See https://github.com/wordpress-mobile/gutenberg-mobile/pull/741#issuecomment-472746541
accessibilityLabel="block-list"
Expand Down Expand Up @@ -381,9 +386,11 @@ export default compose( [
insertBlock,
replaceBlock,
selectBlock,
clearSelectedBlock,
} = dispatch( 'core/block-editor' );

return {
clearSelectedBlock,
insertBlock,
selectBlock,
replaceBlock,
Expand Down