This PR is a first approach trying to make some UX improvements on Offcanvas plugin
It has been buzzing to my ears many times (mostly by designers), that Modals & Offcanvases in order to provide a better user experience, should react on browser history changes.
The simple requirement was : "Should close when the user goes back (swipe back / press back btn, etc)"
So as the #36604 was just another one trigger that shouted the same need
Main functionality:
-
offcanvasInstance.show()
=> adds a hash on our browser address bar (window.location
) & adds an entry to the browser's session history stack. -
offcanvasInstance.hide()
=> removes the hash from our address bar & replicates a history backward step - if User change the hash on his/her address bar, and the
hash
matches to a component registered pattern, we call a callback where we can decide if we are going to handle. In the specific case, we toggle the offcanvas according to thehash
existence. Cases:- when user goes back & forward,
- if user adds/removes a
hash
- if User enters a link on his/her browser address bar and contains a
hash
Preview:
Needs:
-
Feedback (programmatic & functional scope) -
tests (test new functionality, check existing)
closes #36647