Sub topic 7
Pattern: a show/hide filter panel
This chapter builds a filter panel that slides into view when a user clicks a button and disappears when they click again. It assumes you can create visuals and slicers on a report page, know how cross-filtering works, and have read the earlier chapters on the Selection pane, bookmark capture options, and button actions.
What the pattern does
A report page often has more slicers than there is room for. A show/hide panel keeps them out of the way until the user needs them. The panel is a group of objects: a background shape, one or more slicers, and a close button. Two bookmarks control it. One bookmark shows the group, and the other hides it. Two buttons trigger those bookmarks.
The pattern works because a bookmark can store visual visibility. It does not move or delete anything. It only records which objects are hidden in the Selection pane at the moment you capture it.
Step 1: Build the panel objects
- Add a rectangle shape to the page. Give it a fill color and a slight border so it reads as a panel. Size it to cover the area where the panel should appear, such as a strip along the right edge.
- Place the slicers you want inside the rectangle. Slicers must be above the rectangle in layer order, or they will be hidden behind it.
- Insert a button for closing the panel. Use the Back or a custom icon shape, and place it in a corner of the rectangle. You will assign its action later.
- Insert a second button for opening the panel. Place it outside the rectangle, for example in the page header, with the text "Filters".
Step 2: Group and name the objects
Open View > Selection pane. Select the rectangle, the slicers, and the close button together (hold Ctrl and click each one in the pane), then press Ctrl+G to group them. Rename the group to Filter panel.
Grouping matters for two reasons. First, hiding the group hides every object inside it with one click of the eye icon. Second, if you add a slicer later, you can drag it into the group, and both bookmarks keep working without being recaptured, as long as you update the visibility state (see the edge cases below).
Give every object a clear name. Names such as Rectangle 3 become hard to manage once the page has many objects. Names like Panel background, Slicer Category, and Button Close make the Selection pane readable.
Step 3: Create the two bookmarks
First, create the "open" state.
- In the Selection pane, make sure the
Filter panelgroup is visible (eye icon open). - Hide the
Button Openbutton if you want the open button to disappear while the panel is showing. This is optional. Many designs leave it visible. - Open View > Bookmarks and select Add.
- Rename the bookmark to
Panel open.
Next, create the "closed" state.
- In the Selection pane, hide the
Filter panelgroup by clicking its eye icon. - Make
Button Openvisible again if you hid it earlier. - Select Add in the Bookmarks pane and rename the new bookmark
Panel closed.
Set the capture options
The options you choose decide whether the panel behaves well. For each bookmark, use the three dots next to its name and look at the capture settings.
| Option | Setting for this pattern | Why |
|---|---|---|
| Data | Off | The panel must not change or reset slicer selections. The user's filter choices have to survive opening and closing. |
| Display | On | Visibility of objects is what the bookmark exists to store. |
| Current page | On | Keeps the bookmark from switching the user to another page. This is the default and matters most when the report has multiple pages. |
| All visuals vs Selected visuals | Selected visuals, if you can | Limits the bookmark to the panel group and the two buttons, so other visuals on the page are not touched. |
If you leave Data on, clicking "Panel closed" restores the slicer values that existed when you captured the bookmark. A user who picked "Bikes" would see it reset to whatever state you had in Desktop. This is the most common bug in this pattern.
To use selected visuals, select the objects in the Selection pane first (the group, Button Open, and Button Close), then open the bookmark menu and choose Selected visuals, then update the bookmark. Without it, the bookmark records every visual on the page, and any visual you show or hide later is forced back to its captured state when the user clicks.
Step 4: Wire the buttons
Select each button, open Format > Action, switch the action to on, and set these values.
| Button | Action type | Bookmark |
|---|---|---|
| `Button Open` | Bookmark | Panel open |
| `Button Close` | Bookmark | Panel closed |
Use Ctrl+click on a button in Desktop to test it. A plain click only selects the button for formatting. In reading view and in the service, a plain click runs the action.
Add tooltips and alt text
Set a Tooltip under the action settings, for example "Show filters" and "Hide filters". Also add alt text to each button in Format > General > Alt text. Screen reader users otherwise hear only "button".
Step 5: Set the starting state
When the report opens, the panel should be closed. The page itself stores whatever you last saved, so before publishing do this:
- Select the
Panel closedbookmark in the Bookmarks pane, so the canvas is in the closed state. - Save the report with the canvas in that state.
If you save while the panel is visible, users open the report with the panel already showing, and the first click on "Filters" appears to do nothing.
Using one button to toggle
You can use a single button instead of two if you want a toggle. Bookmarks alone cannot read their own state, so the usual approach is to stack two buttons in the same location. The "open" button sits on top and is hidden by the Panel open bookmark. The "close" button sits underneath and is hidden by the Panel closed bookmark. The user sees only one at a time, and it looks like a single button that changes its label.
A different approach uses a bookmark-driven icon swap. Keep both buttons in the Selection pane, each with its own bookmark, and use the pressed state (covered in the previous chapter on button states) to show the active look.
Edge cases and common errors
- Slicers reset when the panel closes. The Data option is on. Turn it off for both bookmarks and update them.
- The panel does not appear. A layer order problem. The rectangle is above the slicers, or another visual overlaps the panel. Reorder objects in the Selection pane. Objects higher in the list are in front.
- A new slicer never shows or never hides. You added it after capturing the bookmarks. The bookmarks do not know about it. Place the slicer in the group, then select each bookmark, adjust the canvas to the right state, and choose Update.
- Opening the panel changes other visuals. The bookmark captures all visuals. Switch it to selected visuals and update.
- Clicking the button navigates to another page. The Current page option is off, so the bookmark restores the page it was captured on. Turn it on.
- Panel hidden but still reachable by keyboard. Objects hidden through the Selection pane are removed from the tab order, so this is usually fine. Check by tabbing through the report in reading view.
- Slicer sync surprises. If the slicers are synced across pages, a change in the panel affects other pages. This is expected, but tell users in the panel title.
Test the pattern
- Switch to reading view, or publish and open the report in the service.
- Click Filters. The panel should appear.
- Pick a category in a slicer. Visuals on the page should filter.
- Click Close. The panel should disappear, and the filter should remain applied.
- Click Filters again. The slicer should still show your choice.
Step 4 is the test that catches the Data option mistake. If the filter disappears, the bookmark is resetting data.
Exercise
A user opens your filter panel, selects "Bikes" in a slicer, clicks the close button, and finds the page is no longer filtered to Bikes. Which bookmark setting is the most likely cause, and how do you fix it?
Show answer
The Data option is on for the "Panel closed" bookmark, so applying it restores the slicer state captured in Desktop. Turn Data off in the bookmark's menu (and for "Panel open" too), then select each bookmark and choose Update so the change is saved.
Exercise
You add a new slicer to the Filter panel group after creating both bookmarks. In reading view the slicer is always visible, even when the panel is closed. Why, and what do you do?
Show answer
The "Panel closed" bookmark recorded the visibility of the objects that existed when it was created, and it does not hide the new slicer. Place the slicer in the group, hide the group in the Selection pane, select the "Panel closed" bookmark, and choose Update. Repeat for "Panel open" with the group visible.