bootstrap
bootstrap copied to clipboard
Added Offcanvas scroll after close option
Description
I added a option scrollAfterClose to be able to disable the scrolling to the offcanvas toggler after the offcanvas is closed.
Motivation & Context
Currently after the offcanvas is closed, the body always scrolling back to the offcanvas toggler position.
When enable offcanvas bodyscrolling and add anchor-links into the offcanvas, the links dont work.
Type of changes
- [ ] Bug fix (non-breaking change which fixes an issue)
- [x] New feature (non-breaking change which adds functionality)
- [ ] Refactoring (non-breaking change)
- [ ] Breaking change (fix or feature that would change existing functionality)
Checklist
- [x] I have read the contributing guidelines
- [x] My code follows the code style of the project (using
npm run lint) - [x] My change introduces changes to the documentation
- [x] I have updated the documentation accordingly
- [ ] I have added tests to cover my changes
- [x] All new and existing tests passed
Live previews
Related issues
Closes #38070
noting that this isn't about scrolling. scrolling is a side effect of focus being (correctly) set back to the element that triggered the offcanvas. so, at the very least, rename this to be about focus, not scroll.
As suggested, I have changed the name of the option.
scrollAfterClose > focusAfterClose
Unfortunately, this still needs tests.