Skip to content

loyaj/quasar-select-menu-scrollbar-fix

Repository files navigation

QSelect: Constrain menu max-width

Account for appearing/disappearing menu scrollbars

Problem

This fix handles the case where scrollbars appear or disappear while the select menu is open. (Code from https://codepen.io/metalsadman/pen/PoOvqBB)

repro

Fix

To demonstrate fix, click the 'Few options' select to open its menu, then drag the bottom of window to shorten the viewport until the menu has scrollbars. Notice that the menu items reactively change width to adjust for the appearance/disappearance of the scrollbar in the menu. View in Stackblitz ⚡️

fix

This fix is based on code linked by @metalsadman in the github issues below. Fix developed and tested with chrome 128 on macos 14.6 with "Show scroll bars" set to "Always" in system preferences.

Related github issues

Install the dependencies

yarn
# or
npm install

Start the app in development mode (hot-code reloading, error reporting, etc.)

quasar dev