sp-dev-fx-controls-react icon indicating copy to clipboard operation
sp-dev-fx-controls-react copied to clipboard

PnP Toolbar filter does not work inside of a panel

Open dbahnms opened this issue 1 year ago • 1 comments

Category

[ ] Enhancement

[X?] Bug

[X] Question

Version

Please specify what version of the library you are using: node: 'v18.20.4', npm: '10.8.1' "@pnp/spfx-controls-react": "^3.19.0",

Code

  <Panel
    isOpen={this.state.showPanelSinglePermission}
    type={PanelType.extraLarge}
    onDismiss={this._hidePanelSinglePermission}
  >
    <div>

          <Toolbar 
            style={{marginTop: -20}}
            actionGroups={{
            'share': {
              'reload': {
                title: ls[browserlanguage].toolbars.reload,
                iconName: 'UpdateRestore',
                onClick: () => this.componentReload(this.state.filtervalue)
              }
            }
            }}
        
            filters={[
              {
                className: styles.combobox,
                id: "f3",
                title: ls[browserlanguage].toolbars.filter.Sharing,
                items: [
                  { id: "f3f1", title: ls[browserlanguage].toolbars.filter.Guest },
                  { id: "f3f2", title: ls[browserlanguage].toolbars.filter.Everyone },
                  { id: "f3f3", title: ls[browserlanguage].toolbars.filter.Member },
                  { id: "f3f4", title: ls[browserlanguage].toolbars.filter.Link }
                ]
              },
              {
                id: "f2",
                title: ls[browserlanguage].toolbars.filter.Library,
                items: this.state.sitelists
              }
            ]}
            
            onSelectedFiltersChange={this._onSelectedFiltersChange.bind(this)}
            find={true}
            onFindQueryChange={this._findItem}
          />
    </div>
  </Panel>

Expected / Desired Behavior / Question

When I use this code directly (without an panel) it works corrently. image

If I embed the toolbar inside of an panel, the filter does not work and sometimes I got the following error message in my browser: Blocked aria-hidden on a

How can I fix that?

Observed Behavior

Filter opened and chooseable

Steps to Reproduce

  • Add an toolbar inside of an fluent ui panel

dbahnms avatar Sep 18 '24 13:09 dbahnms

Thank you for submitting your first issue to this project.

github-actions[bot] avatar Sep 18 '24 13:09 github-actions[bot]

I have reproduced your scenario. It turns out that filter popup does in fact open and render properly, but it is placed below the panel due to lower z-index value (popup control has z-index: 1000, whereas panel has z-index: 1000000).

image

You would see the popup if you had changed z-index to a value higher than panel has:

image

As a quick fix, I would recommend changing your code and switching Panel from fluentui to Dialog from fluentui/react-northstar. Dialog component has z-index: 1000 and works well with nested popups. https://fluentsite.z22.web.core.windows.net/0.66.2/prototype-nested-popups-and-dialogs

wilecoyotegenius avatar Oct 01 '24 20:10 wilecoyotegenius

Thanks for debugging!!!

Unfortunately, it's not that easy to implement due to some dependencies. Is there a time frame when it could be fixed?

Currently the following workaround works:

  • modify css with:

:global { div.ui-popup__content:has(> div.ui-popup__content__content > div.extended-toolbar__filters-menu) { z-index: 1000000; } }

dbahnms avatar Nov 20 '24 13:11 dbahnms

Hi @dbahnms,

The Toolbar control is using the react-northstar Popup component under the hood, which by design doesn't provide a prop to handle its CSS properties.

The only path I would search for is on the Fluent UI Panel side which you can customize through layerProps or popupProps. But at this point, I don't have working example to provide.

Another way to achieve this would be to replace the Toolbar control by the Fluent UI CommandBar or ContextualMenu.

We won't be able to fix this due to the nature of the component.

michaelmaillot avatar Jan 31 '25 18:01 michaelmaillot

Closing this, feel free to reopen it if needed.

michaelmaillot avatar Mar 24 '25 22:03 michaelmaillot