Skip to content

Commit

Permalink
Fix bug with dropdowns and overlays on some browsers
Browse files Browse the repository at this point in the history
  • Loading branch information
FlorianCassayre committed Dec 2, 2021
1 parent cac1859 commit a6ac5a4
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/components/DownloadButton.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ function SelectionInput({ name, value, values, label, renderValue, setValue }) {
{label}
</Col>
<Col xs={6} sm={7}>
<Dropdown as="span">
<Dropdown as="span" onClick={(e) => e.stopPropagation()}>
<Dropdown.Toggle variant="light" id="dropdown-basic">
{renderValue(values[value])}
</Dropdown.Toggle>
Expand Down
3 changes: 2 additions & 1 deletion src/components/PermalinkButton.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ export function PermalinkButton({ disabled, isTabStats, ...props }) {
</Popover>
}
>
<Button variant="info" disabled={disabled} {...props}>
{/* The workaround needs to be applied to the button, rather than the `OverlayTrigger` */}
<Button variant="info" onClick={(e) => e.stopPropagation()} disabled={disabled} {...props}>
<PinFill className="icon" />
</Button>
</OverlayTrigger>
Expand Down
11 changes: 10 additions & 1 deletion src/components/SettingsButton.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,16 @@ export function SettingsButton({ ...props }) {
const isSettingsUntouched = deepEqual(state, defaultState);

return (
<DropdownButton variant="secondary" id="dropdown-advanced-configuration" title={<GearFill className="icon" />} as="span" show={isShown} onToggle={(isOpen, event, metadata) => setIsShown(isOpen ? true : metadata.source === 'select')} {...props}>
<DropdownButton
variant="secondary"
id="dropdown-advanced-configuration"
title={<GearFill className="icon" />}
as="span"
show={isShown}
onToggle={(isOpen, event, metadata) => setIsShown(isOpen ? true : metadata.source === 'select')}
onClick={(e) => e.stopPropagation()}
{...props}
>
<Dropdown.Header><FormattedMessage id="settings.search" /></Dropdown.Header>
<Dropdown.Item onClick={() => setMatchesHighlightingDispatch(!matchesHighlighting)}>
<CheckboxIcon isEnabled={matchesHighlighting} />
Expand Down
2 changes: 1 addition & 1 deletion src/form/ResultsPerPageSelect.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export function ResultsPerPageSelect({ values, disabled, ...props }) {
const setCurrentPageDispatch = currentPage => dispatchForm(setResultsPerPage(currentPage));
const value = form.resultsPerPage;
return (
<Dropdown className="results-per-page-select" {...props}>
<Dropdown className="results-per-page-select" onClick={(e) => e.stopPropagation()} {...props}>
<Dropdown.Toggle variant="light" id="dropdown-basic" disabled={disabled}>
{value}
</Dropdown.Toggle>
Expand Down
2 changes: 1 addition & 1 deletion src/form/SearchPlaceInput.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ function SearchPlaceField({ value, onChange, disabled }) {
}, [open]);

return (
<Dropdown onToggle={handleToggle}>
<Dropdown onToggle={handleToggle} onClick={(e) => e.stopPropagation()}> {/* See https://github.com/react-bootstrap/react-bootstrap/issues/5409 */}
<Dropdown.Toggle variant="light" disabled={disabled} id="place-dropdown" className="text-left btn-block text-nowrap overflow-hidden">
{value.length > 0 ? value[0].fullname : (
<FormattedMessage id="form.place" />
Expand Down

0 comments on commit a6ac5a4

Please sign in to comment.