Giter VIP home page Giter VIP logo

Comments (10)

fabian-hiller avatar fabian-hiller commented on May 27, 2024 2

Thanks for the hint. Unfortunately, I can't implement it at the moment. Our current Qwik version does not allow us to call event.preventDefault() in a fine-grained way. We can only call it for every keydown event, and that breaks the website. I will have to upgrade to the latest Qwik version first, but that will take a few weeks because other things are more important at the moment.

from valibot.

Hugos68 avatar Hugos68 commented on May 27, 2024 1

Ah, I see you are using the meta key that only works on mac, on windows the meta key is reserved for some windows popup, on windows it's common to use ctrl instead, I have implemented it like this (for different website):

	function keydownHandler(event: KeyboardEvent) {
		if (event.key !== 'k' || !(event.ctrlKey || event.metaKey)) {
	            return;
		}
		event.preventDefault();
                searchDialog.open();
	}

Now both ctrl + k and cmd + k work, assuming you don't have ctrl + k reserved for anything else this should do the trick.

from valibot.

Hugos68 avatar Hugos68 commented on May 27, 2024 1

I've edited the issue to be more accurate (I wasn't aware it was already implemented at the time of creating the issue)

from valibot.

Hugos68 avatar Hugos68 commented on May 27, 2024 1

@fabian-hiller Just checked, all works properly now, thanks!

from valibot.

fabian-hiller avatar fabian-hiller commented on May 27, 2024

This should be implemented already. Does it not work for you? It works for me. Here is the source code: https://github.com/fabian-hiller/valibot/blob/v0.28.1/website/src/components/DocSearch.tsx#L291

from valibot.

fabian-hiller avatar fabian-hiller commented on May 27, 2024

Thank you for creating this issue! I will investigate and fix this!

from valibot.

Hugos68 avatar Hugos68 commented on May 27, 2024

Awesome, thank you for the quick response!

from valibot.

fabian-hiller avatar fabian-hiller commented on May 27, 2024

Can you check if it works on Windows now?

from valibot.

Hugos68 avatar Hugos68 commented on May 27, 2024

It works but you need to prevent the default, otherwise the browser will bring focus to the search bar:
image

from valibot.

fabian-hiller avatar fabian-hiller commented on May 27, 2024

@Hugos68 can you check if this is fixed now?

from valibot.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.