canonical / react-components

A set of components based on Vanilla Framework
https://canonical.github.io/react-components
95 stars 51 forks source link

fix(modal): do not scroll content when opened #999

Closed andesol closed 7 months ago

andesol commented 9 months ago

Done

Problem

The modal opens with the content scrolled (when there's enough content to be scrollable), so the user can't read from the beginning. It seems like this behaviour was introduced in this commit, where the focus is moved to one of the buttons on the footer.

Solution

Focus without scrolling into view.

QA

QA steps

Fixes

Fixes: #958

andesol commented 9 months ago

Is the support for this option good enough? https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/focus#browser_compatibility