owncloud / web

:dragon_face: Next generation frontend for ownCloud Infinite Scale
https://owncloud.dev/clients/web/
GNU Affero General Public License v3.0
418 stars 157 forks source link

Closing an editor with a dirty state focuses wrong button #11091

Closed JammingBen closed 1 week ago

JammingBen commented 1 week ago

Describe the bug

Closing an editor with a dirty state (unsaved changes) will show a modal, asking the user if they want to save or leave without saving the document. The modal currently focuses the "Don't save" button initially, which is suboptimal since one single keypress might discard all the changes.

Steps to reproduce

  1. Open a text document with the text editor app
  2. Change something, don't save
  3. Hit the "back"-button in your browser
  4. Hit enter as soon as the modal shows

Expected behavior

The document should be saved and closed.

Actual behavior

The document is not being saved.

Note that we can only fix this for our own modal which shows when e.g. hitting the "back"-button in the browser or when closing the editor via the app bar. Closing the browser tab/window creates a browser popup which we can't control.

kulmann commented 1 week ago

Closed via https://github.com/owncloud/web/pull/11094