Skip to content

Commit

Permalink
optimize keyboard focus states in move mode
Browse files Browse the repository at this point in the history
  • Loading branch information
jloleysens committed Oct 1, 2020
1 parent 8cfa36e commit eb7d539
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,23 @@ export interface Props {
placeholder: string;
ariaLabel: string;
onChange: (value: string) => void;
disabled: boolean;
/**
* Whether the containing element of the text input can be focused.
*
* If it cannot be focused, this component cannot switch to showing
* the text input field.
*
* Defaults to false.
*/
disabled?: boolean;
text?: string;
}

export const InlineTextInput: FunctionComponent<Props> = ({
disabled,
placeholder,
text,
ariaLabel,
disabled = false,
onChange,
}) => {
const [isShowingTextInput, setIsShowingTextInput] = useState<boolean>(false);
Expand Down Expand Up @@ -71,7 +79,11 @@ export const InlineTextInput: FunctionComponent<Props> = ({
/>
</div>
) : (
<div className={containerClasses} tabIndex={0} onFocus={() => setIsShowingTextInput(true)}>
<div
className={containerClasses}
tabIndex={disabled ? -1 : 0}
onFocus={() => setIsShowingTextInput(true)}
>
<EuiText size="s" color="subdued">
<div className="pipelineProcessorsEditor__item__description">
{text || <em>{placeholder}</em>}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ export const PipelineProcessorsEditorItem: FunctionComponent<Props> = memo(
color={isDimmed ? 'subdued' : undefined}
>
<EuiLink
tabIndex={isEditorNotInIdleMode ? -1 : 0}
disabled={isEditorNotInIdleMode}
onClick={() => {
editor.setMode({
Expand Down

0 comments on commit eb7d539

Please sign in to comment.