Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MDE behaves differently when submitted via mouse click vs keyBinding #12858

Open
bilogic opened this issue May 19, 2024 · 6 comments
Open

MDE behaves differently when submitted via mouse click vs keyBinding #12858

bilogic opened this issue May 19, 2024 · 6 comments
Labels
bug Something isn't working low priority unconfirmed
Milestone

Comments

@bilogic
Copy link

bilogic commented May 19, 2024

Package

filament/forms

Package Version

3.2.80

Laravel Version

11.7.0

Livewire Version

3.4.12

PHP Version

8.2.18

Problem description

The behavior of clicking on submit vs pressing the registered keyBinding() is different.
Clicking will clear the form. (correct)
Pressing the shortcut key does not. (incorrect)

Expected behavior

Pressing the shortcut key should also clear the form.

Steps to reproduce

  1. Type something into the markdown editor at /admin/issue
  2. Press ctrl + enter

Reproduction repository

https://github.com/bilogic/filament-issue/tree/click-different-from-keyBindings

Relevant log output

vid.mp4

No response

@alexmanase
Copy link

It's because of this line:

if (this.editor.codemirror.hasFocus()) {

When the editor is focused, the state is not changed.

@danharrin if you think this is a bug, I can create a PR.

@danharrin
Copy link
Member

Its deliberate, to prevent an infinite loop of state updates when the editor is being typed into

@bilogic
Copy link
Author

bilogic commented May 30, 2024

Well, what I can say is, from a user POV, it looks like a bug.
Perhaps ctrl + enter can be made to steal the focus first before submitting?

@alexmanase will your PR overcome the infinite loop?

@alexmanase
Copy link

I guess. Still looking into it.

@alexmanase alexmanase mentioned this issue May 30, 2024
3 tasks
@alexmanase
Copy link

Perhaps ctrl + enter can be made to steal the focus first before submitting?

Thank you @bilogic. After checking other solutions, this one seemed to be the best. Let's see if ok for merging.

@bilogic
Copy link
Author

bilogic commented May 30, 2024

Thanks for the fix!

@zepfietje zepfietje added this to the v3 milestone Jun 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working low priority unconfirmed
Projects
Status: Todo
Development

Successfully merging a pull request may close this issue.

4 participants