The CloseWatcher API landed in Firefox 149, making it easy to listen for platform-specific 'dismiss' signals. Here's how it works:
And, of course, the full documentation on MDN https://developer.mozilla.org/en-US/docs/Web/API/CloseWatcher
CloseWatcher - Web APIs | MDN

The CloseWatcher interface allows a custom UI component with open and close semantics to respond to device-specific close actions in the same way as a built-in component.

MDN Web Docs
@firefoxwebdevs Something I noticed in the example is that if the browser does not support CloseWatcher, the "Close" button does not work.
I get that the button's event listener calls watcher.close() for demonstration purposes, but I feel that in production it would be more appropriate to call closeSidebar() instead, maybe the accompanying text should reflect that?
@firefoxwebdevs Also of note: on Firefox for Android Beta 149.0b10, the "Close" button works, but it does not intercept the back gesture, returning to the previous page instead. Chrome behaves as expected.