Skip to content

Scrolling should be validated when there are no tabs but sticky buttons are present #469

@schtauffen

Description

@schtauffen

Describe the bug

Currently users can scroll tabsets when no tabs are open but there are stickybuttons persent.

Your Example Website or App

No response

Steps to Reproduce the Bug or Issue

Add a sticky button such as:

<Layout onRenderTabSet={(node, renderValues) =>  {
  renderValues.push(<button>+</button>);
  }} />

Close any tabs that may be present.
Observe that you can use your mouse scroll wheel to move the sticky buttons around, even out of visibility range.

Expected behavior

We have patched flexlayout to just setPosition(0) in this scenario:

// updateVisibleTabs in TabOverflowHook.tsx (Line 96 for 18.2.0)
            if (node.getChildren().length === 0 && stickyButtonsSize !== 0) {
                setPosition(0);
            }

A better solution would validate if sticky buttons are hidden to allow scrolling but in our case disallowing it is sufficient.

Operating System

macOS

Browser Type?

Google Chrome

Browser Version

n/a

Screenshots or Videos

Prior to scrolling:
image

Sticky button scrolled into other positions:
image

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions