filament icon indicating copy to clipboard operation
filament copied to clipboard

Keybindings only work first time after page load

Open adevade opened this issue 1 year ago • 5 comments

Package

filament/filament

Package Version

v3.x

Laravel Version

v10.x

Livewire Version

v3.x

PHP Version

PHP 8.x

Problem description

A defined key binding only works the first time after a page load. Then no action is fired.

This is the only related topic I could find: https://github.com/filamentphp/filament/discussions/3970

Expected behavior

I expect the action to fire every time I press the key combination.

Steps to reproduce

  1. Go to https://demo.filamentphp.com/shop/products/1/edit
  2. Press CTRL+S/CMD+S and see the page save
  3. Try again, and it does not work until the page is fully refreshed

Reproduction repository

https://github.com/filamentphp/demo

Relevant log output

No response

adevade avatar Oct 03 '23 21:10 adevade

Related warning:

Form submission canceled because the form is not connected
h @ app.js?v=3.0.63.0:1
(anonymous) @ app.js?v=3.0.63.0:1
x @ app.js?v=3.0.63.0:1
t._handleKey @ app.js?v=3.0.63.0:1
v.handleKey @ app.js?v=3.0.63.0:1
G @ app.js?v=3.0.63.0:1

erikgaal avatar Oct 06 '23 07:10 erikgaal

More info: If the text cursor is placed in the Name field (or any other input field) on the demo product and you press enter — submitting the form like usual — it works every time.

adevade avatar Oct 13 '23 13:10 adevade

Was just about to complain and suggest this was a problem with the Alpine Mousetrap plugin, then realised I was the one who built it, whoops

danharrin avatar Dec 07 '23 00:12 danharrin

This actually breaks after any Livewire request, not just the first time the keybinding is used

danharrin avatar Dec 07 '23 00:12 danharrin

Has anyone been able to find a workaround for this? Still seems to be happening.

illusive-ch avatar Apr 13 '24 00:04 illusive-ch

@danharrin if you know, mind sharing what that bug was in alpine mousetrap? that will save us from investigating and get a headstart in solving the problem.

bilogic avatar May 06 '24 05:05 bilogic

I don't know what the bug is, that will need to be investigated by whoever decides to pursuit a fix

danharrin avatar May 06 '24 07:05 danharrin

Alright thanks, let me find some bandwidth to deal with it.

bilogic avatar May 06 '24 09:05 bilogic

I don't think this is a dependency issue; it's more related to browser behavior. As a quick solution, we can use a click event. Check #12672, please

dmitry-udod avatar May 07 '24 16:05 dmitry-udod

thanks!

bilogic avatar May 07 '24 17:05 bilogic

@dmitry-udod

My form has a filament markdown editor

  1. If I click the form submit button using mouse, it correctly clears its own content
  2. But if I press ctrl+enter, it does not clear its content

Do you face this issue?

bilogic avatar May 19 '24 01:05 bilogic

I filed https://github.com/filamentphp/filament/issues/12858 for MDE not clearing it's contents when submitting via keyboard

bilogic avatar May 19 '24 07:05 bilogic