question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

feat request: conditioning `preventdefault:event `

See original GitHub issue

Is your feature request related to a problem?

Implementing a search box, need a way to skip keydown event only when the key is ArrowUp , ArrowDown

Describe the solution you’d like

let attribute value be more descriptive by certain structure ? such as preventdefault:keydown="{ key: ['arrow'] }" ?

Describe alternatives you’ve considered

  1. Considering Vue have event key modifier like @keydonw.enter we can do the similar preventdefault:keydown.enter ?
  2. add a special way to bind event handle in sync for edge case that have to prevent dynamically ?

Additional context

No response

Issue Analytics

  • State:open
  • Created a year ago
  • Reactions:1
  • Comments:11 (10 by maintainers)

github_iconTop GitHub Comments

1reaction
nnelgxorzcommented, Aug 23, 2022

Custom events? Although, I thunk the solution there should be more automatic than manual.

https://github.com/BuilderIO/qwik/issues/786

1reaction
nnelgxorzcommented, Aug 20, 2022

Yeah, I’d be curious how much it adds to the Qwikloader size. I don’t know if the simple rules are an issue for most use cases. I mean, as of right now preventDefault with no conditions seems to work for 99.9% of the use cases.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Event.preventDefault() - Web APIs | MDN
The preventDefault() method of the Event interface tells the user agent that if the event does not get explicitly handled, its default ...
Read more >
How to prevent default event handling in an onclick method?
Let your callback return false and pass that on to the onclick handler: <a href="#" onclick="return callmymethod(24)">Call</a> function callmymethod(myVal){ ...
Read more >
preventDefault() Event Method - W3Schools
The preventDefault() method cancels the event if it is cancelable, meaning that the default action that belongs to the event will not occur....
Read more >
preventDefault() Event Method - GeeksforGeeks
It can prevent the user from processing the request by clicking the link. Syntax: event.preventDefault(). Parameters: It does not accept any ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found