-
Notifications
You must be signed in to change notification settings - Fork 841
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[EuiButtonGroup] Fix initial focus when in a popover (#4288)
By removing the `transition: all` on the `.euiButtonGroup__buttons` selector - Also added an example to the compressed forms page.
- Loading branch information
Showing
4 changed files
with
109 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
80 changes: 80 additions & 0 deletions
80
src-docs/src/views/form_compressed/form_compressed_popover.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
import React, { useState } from 'react'; | ||
|
||
import { | ||
EuiFieldText, | ||
EuiFormRow, | ||
EuiSelect, | ||
EuiButton, | ||
EuiPopover, | ||
EuiButtonGroup, | ||
} from '../../../../src/components'; | ||
|
||
export default () => { | ||
const [isPopoverOpen, setIsPopoverOpen] = useState(false); | ||
const [granularityIdSelected, setGranularityIdSelected] = useState( | ||
'granularityButton1' | ||
); | ||
|
||
const onButtonClick = () => | ||
setIsPopoverOpen((isPopoverOpen) => !isPopoverOpen); | ||
const closePopover = () => setIsPopoverOpen(false); | ||
|
||
const onGranularityChange = (optionId) => { | ||
setGranularityIdSelected(optionId); | ||
}; | ||
|
||
const button = ( | ||
<EuiButton iconType="arrowDown" iconSide="right" onClick={onButtonClick}> | ||
Open form in popover | ||
</EuiButton> | ||
); | ||
|
||
const granularityToggleButtons = [ | ||
{ | ||
id: 'granularityButton1', | ||
label: 'Left', | ||
}, | ||
{ | ||
id: 'granularityButton2', | ||
label: 'Middle', | ||
}, | ||
{ | ||
id: 'granularityButton3', | ||
label: 'Right', | ||
}, | ||
]; | ||
|
||
return ( | ||
<EuiPopover | ||
button={button} | ||
isOpen={isPopoverOpen} | ||
closePopover={closePopover}> | ||
<div style={{ width: 300 }}> | ||
<EuiFormRow label="Button group" display="columnCompressed"> | ||
<EuiButtonGroup | ||
legend="Granulariy of zoom levels" | ||
options={granularityToggleButtons} | ||
idSelected={granularityIdSelected} | ||
onChange={onGranularityChange} | ||
buttonSize="compressed" | ||
isFullWidth | ||
/> | ||
</EuiFormRow> | ||
<EuiFormRow label="Text field" display="columnCompressed"> | ||
<EuiFieldText name="first" compressed /> | ||
</EuiFormRow> | ||
|
||
<EuiFormRow label={'Select'} display="columnCompressed"> | ||
<EuiSelect | ||
options={[ | ||
{ value: 'option_one', text: 'Option one' }, | ||
{ value: 'option_two', text: 'Option two' }, | ||
{ value: 'option_three', text: 'Option three' }, | ||
]} | ||
compressed | ||
/> | ||
</EuiFormRow> | ||
</div> | ||
</EuiPopover> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters