Skip to content

feat: Use CloseWatcher API for modals etc #28703

Closed

Description

@lukewarlow

Prerequisites

Describe the Feature Request

It could be useful for ionic to make use of the new close watcher api [1][2] to listen for close signals to close components such as alert dialogs.

[1] https://html.spec.whatwg.org/multipage/interaction.html#the-closewatcher-interface
[2] https://developer.chrome.com/blog/new-in-chrome-120#close-watcher

Describe the Use Case

This API allows listening for escape key presses, along with more platform specific close signals such as Android's back button/ gesture. This would provide a more native feel (matching both the native platform and the web).

It would also improve accesibility as it supports Talkback back gestures too.

Describe Preferred Solution

The close watcher API being used when supported feels like the best solution.

Describe Alternatives

No response

Related Code

No response

Additional Information

No response

Activity

  1. self-assigned this
    on Dec 14, 2023
  2. liamdebeasi commented on Dec 14, 2023

    @liamdebeasi
    Contributor

    Thanks, I think this would be good for us to support. I have an experimental version if you want to give it a try:

    Angular

    npm install @ionic/angular@7.6.1-dev.11702569564.1746fa9f
    

    React

    npm install @ionic/react@7.6.1-dev.11702569564.1746fa9f @ionic/react-router@7.6.1-dev.11702569564.1746fa9f
    

    Vue

    npm install @ionic/vue@7.6.1-dev.11702569564.1746fa9f @ionic/vue-router@7.6.1-dev.11702569564.1746fa9f
    

    Stencil/Vanilla JavaScript

    npm install @ionic/core@7.6.1-dev.11702569564.1746fa9f
    

    The feature is added behind an experimentalCloseWatcher flag in the IonicConfig, so you will need to set experimentalCloseWatcher: true before you can use it. Once enabled, you will be able to use this API to dismiss overlays, menus, and navigate in a non-Cordova/non-Capacitor environment on supported browsers (Chrome 120+ as of writing).

  3. removed their assignment
    on Dec 21, 2023
  4. added a commit that references this issue on Jan 5, 2024
    658d1ca
  5. liamdebeasi commented on Jan 5, 2024

    @liamdebeasi
    Contributor

    Thanks for the issue. This has been resolved via #28705, and the feature will be available in an upcoming release of Ionic Framework.

  6. added a commit that references this issue on Jan 31, 2024
    baedec5
  7. ionitron-bot commented on Feb 4, 2024

    @ionitron-bot

    Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Ionic, please create a new issue and ensure the template is fully filled out.

  8. locked and limited conversation to collaborators on Feb 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions