Some component libraries take a stand that “back button” support has to be arranged by the caller outside the lightbox (controlled). But that causes numerous issues, including inability to make closing vetoable.
Back button support is HARD. Standard doesn’t exist.
Supporting back button involves the following considerations:
Rollback of history pop for vetoable close is especially hard and requires in-depth knowledge of the stack to re-push the popped states. Some routers (e.g. ReactRouter) allow history-stack blocking for this. But it’s rare and usually buggy.
A naive history.pushState can break a React router and can never be fully featured.
See also #43 on the discussion about controlled-vs-uncontrolled lightbox API.
Context: https://github.com/ampproject/amp-react-prototype/pull/8/files#diff-c554b9bd31408e663cff269f69a1c567R51
Issues:
Supporting back button involves the following considerations:
history.pushState
can break a React router and can never be fully featured.See also #43 on the discussion about controlled-vs-uncontrolled lightbox API.