Dragos Rachieru
04/08/2022, 7:37 AMBackHandler should be ported to desktop and web as well as we can use the buttons to go back (I use mouse buttons to navigate on desktop). I was writing a multiplatform navigation component and it needs multiplatform BackHandler, I have an expect/actual for that, but it would be great for it to be part of the compose libraryhfhbd
04/08/2022, 8:30 AMDragos Rachieru
04/08/2022, 9:11 AMhfhbd
04/08/2022, 9:17 AMDragos Rachieru
04/08/2022, 9:30 AMKirill Grouchnikov
04/08/2022, 4:13 PMnschulzke
04/08/2022, 5:02 PMKebbin
04/10/2022, 10:39 AMnschulzke
04/11/2022, 3:31 PMBackHandler exists on Android is because it's the only built-in navigation button that isn't handled by the operating system (ignoring a few apps that hijack the volume keys for navigation). All other interactivity is actually defined on-screen by the app itself, so it doesn't need a separate handler.
On web and desktop, by contrast, there are tons of keys and key combos that are used for navigation. It would be hard to justify having a dedicated BackHandler without also having a LeftKeyHandler and a RightKeyHandler and a ShiftEnterHandler, etc.
If something like this were to be a part of Compose for Web or for Desktop, it would need to be a generic KeypressHandler and/or MouseButtonHandler in order to make sense. On web this is already trivial to achieve with an event handler on document. If something similar doesn't exist on Desktop, it probably should, and it would make sense to wrap it in an API that is usable on both. But we don't need a dedicated BackHandler.