Skip to content

Commit

Permalink
fix: add EuiOutsideClickDetector (elastic#78733) (elastic#79095)
Browse files Browse the repository at this point in the history
Co-authored-by: Elastic Machine <[email protected]>

Co-authored-by: Elastic Machine <[email protected]>
  • Loading branch information
mbondyra and elasticmachine authored Oct 1, 2020
1 parent 5ca5fa3 commit 90d9334
Showing 1 changed file with 33 additions and 30 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import {
EuiButtonEmpty,
EuiFlexItem,
EuiFocusTrap,
EuiOutsideClickDetector,
} from '@elastic/eui';

import classNames from 'classnames';
Expand Down Expand Up @@ -91,37 +92,39 @@ export function DimensionContainer({

const flyout = flyoutIsVisible && (
<EuiFocusTrap disabled={!focusTrapIsEnabled} clickOutsideDisables={true}>
<div
role="dialog"
aria-labelledby="lnsDimensionContainerTitle"
className={classNames('lnsDimensionContainer', {
'lnsDimensionContainer--noAnimation': openByCreation,
})}
>
<EuiFlyoutHeader hasBorder className="lnsDimensionContainer__header">
<EuiTitle size="xs">
<EuiButtonEmpty
onClick={closeFlyout}
data-test-subj="lns-indexPattern-dimensionContainerTitle"
id="lnsDimensionContainerTitle"
iconType="sortLeft"
flush="left"
>
<strong>{panelTitle}</strong>
<EuiOutsideClickDetector onOutsideClick={closeFlyout} isDisabled={!flyoutIsVisible}>
<div
role="dialog"
aria-labelledby="lnsDimensionContainerTitle"
className={classNames('lnsDimensionContainer', {
'lnsDimensionContainer--noAnimation': openByCreation,
})}
>
<EuiFlyoutHeader hasBorder className="lnsDimensionContainer__header">
<EuiTitle size="xs">
<EuiButtonEmpty
onClick={closeFlyout}
data-test-subj="lns-indexPattern-dimensionContainerTitle"
id="lnsDimensionContainerTitle"
iconType="sortLeft"
flush="left"
>
<strong>{panelTitle}</strong>
</EuiButtonEmpty>
</EuiTitle>
</EuiFlyoutHeader>
<EuiFlexItem className="eui-yScrollWithShadows" grow={1}>
{panel}
</EuiFlexItem>
<EuiFlyoutFooter className="lnsDimensionContainer__footer">
<EuiButtonEmpty flush="left" size="s" iconType="cross" onClick={closeFlyout}>
{i18n.translate('xpack.lens.dimensionContainer.close', {
defaultMessage: 'Close',
})}
</EuiButtonEmpty>
</EuiTitle>
</EuiFlyoutHeader>
<EuiFlexItem className="eui-yScrollWithShadows" grow={1}>
{panel}
</EuiFlexItem>
<EuiFlyoutFooter className="lnsDimensionContainer__footer">
<EuiButtonEmpty flush="left" size="s" iconType="cross" onClick={closeFlyout}>
{i18n.translate('xpack.lens.dimensionContainer.close', {
defaultMessage: 'Close',
})}
</EuiButtonEmpty>
</EuiFlyoutFooter>
</div>
</EuiFlyoutFooter>
</div>
</EuiOutsideClickDetector>
</EuiFocusTrap>
);

Expand Down

0 comments on commit 90d9334

Please sign in to comment.