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

DropdownSection #1409

Merged
merged 25 commits into from
Feb 12, 2024
Merged

DropdownSection #1409

merged 25 commits into from
Feb 12, 2024

Conversation

labkey-alan
Copy link
Contributor

@labkey-alan labkey-alan commented Feb 5, 2024

Rationale

This PR adds DropdownSection as a replacement for SubMenu so we can remove all remaining usages of DropdownButton and MenuItem from react-bootstrap.

Related Pull Requests

Changes

  • DisableableMenuItem: change operationPermitted prop to disabled
    • not just a rename, this inverts the expected value
  • Add DropdownSection
    • Replaces SubMenuItem, but outputs DOM structure expected by Bootstrap
  • Add DropdownWithSections
    • Replaces SubMenu, but outputs DOM structure expected by Bootstrap
  • ResponsiveMenuButton:
    • use DropdownSection
    • remove id prop
    • add className prop
  • Remove SubMenu
  • Remove SubMenuItem
  • Remove getMenuItemsForSection (unused)

@labkey-alan labkey-alan self-assigned this Feb 5, 2024
@labkey-alan labkey-alan marked this pull request as draft February 5, 2024 18:27
@labkey-alan labkey-alan marked this pull request as ready for review February 7, 2024 16:59
<MenuItem>
<input
onChange={onFilterChange}
onClick={onFilterClick}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the onclick for this filter input just calls preventDocumentHandler. Is that needed? I wouldn't have expected this input to need any onClick handler.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is needed or clicking on the filter input will close the menu

@@ -190,7 +190,7 @@ export const FindDerivativesMenuItem: FC<Props> = memo(props => {

return (
<DisableableMenuItem
operationPermitted={!invalidFilterNames}
disabled={invalidFilterNames !== ''}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can invalidFilterNames be undefined?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No because it's calculated from an array.join(',') on an array that is always defined and defaults to [].

@@ -324,6 +324,8 @@ export const FilterExpressionView: FC<Props> = memo(props => {
const expanded = expandedOntologyKey === ontologyBrowserKey;
// FIXME: This is not a proper usage of Dropdown, as it is not rendering any MenuItems this behavior
// should be accomplished some other way (OverlayTrigger + Popover with click events?)
// Note: we can just replace this with some basic logic to show/hide it and render it inline, it does
// not need to render as a floating item, so Dropdown is very unnecessary.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I assume this is for another / separate PR?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, going to handle this case with the ProductMenu et. al.

@labkey-alan labkey-alan merged commit a33a03a into develop Feb 12, 2024
1 check passed
@labkey-alan labkey-alan deleted the fb_submenu branch February 12, 2024 18:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants