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

Error in inputfields.js addHeaderAction() #1976

Open
Toutouwai opened this issue Sep 20, 2024 · 0 comments
Open

Error in inputfields.js addHeaderAction() #1976

Toutouwai opened this issue Sep 20, 2024 · 0 comments

Comments

@Toutouwai
Copy link

Toutouwai commented Sep 20, 2024

Short description of the issue

I'm adding an inputfield header action:

$inputfield->addHeaderAction([
    'icon' => 'question-circle',
    'event' => 'testing',
]);

Clicking on the header action icon causes this JS error in the browser console:

2024-09-20_210214

I think line 1333 is perhaps supposed to be:

if(settings.event) $icon.trigger(settings.event, [ $icon ]);

Also, I'd like to be able to have both an href and an event for the same header action, so can the logic please be updated so that the event is triggered even if the href option is set? And the callback option too as I can imagine using that together with an href.

Lastly, please don't use return false in event listeners as this prevents other JS code from listening to the same event. Discussed here: #1028

If there's some existing core event listener that's getting triggered by the click when it shouldn't be, it would be better to update that listener to exclude the case according to the event target. E.g. at line 2696:

if($(event.target).hasClass('InputfieldHeaderAction')) return;
  • ProcessWire version: 3.0.241
ryancramerdesign added a commit to processwire/processwire that referenced this issue Oct 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants