Email me at [email protected]
ozzyczech / cmd-dialog Goto Github PK
View Code? Open in Web Editor NEWCommand dialog and keyboard shortcuts palette for web apps.
Home Page: https://cmd-dialog.vercel.app
License: MIT License
Command dialog and keyboard shortcuts palette for web apps.
Home Page: https://cmd-dialog.vercel.app
License: MIT License
Email me at [email protected]
'cmd+a' works perfectly.
'cmd+a+d' doesn't work and the first press of 'cmd+a' in safari just selects the whole page.
According to jaywcjlove/hotkeys-js#55 this should be possible?
Im not convinced the close button (and the closing of the dialog by pressing esc or clicking outside) is working as expected.
I was expecting that on closing the dialog the new code at
Line 286 in 57617f1
To replicate type github, click X, open the cmd+k, and see that only Github is showing, no other actions are visible, I think your intention here was that all should be visible because of this._results = this.actions;
which doesnt seem to be working
set a hotkey for and item for cmd+n
attempt to use cmd+n
It opens a new browser window, when it should trigger the action/url from the item
The hotkeys docs https://github.com/jaywcjlove/hotkeys#defining-shortcuts state you should be able to return false to override browser default behaviour, I tried that in your source code and it did not work either, you are already having event.preventDefault()
in your code.. Im no JS expert sorry, Im mainly PHP :)
// Returning false stops the event and prevents default browser events
// Mac OS system defines `command + r` as a refresh shortcut
hotkeys('ctrl+r, command+r', function() {
alert('stopped reload!');
return false;
});
Assign the letter A to a menu item (Like "Your Account")
invoke cmd+k
note that Your Account has a [A]
correctly - note you can arrow down and select it and it runs...
BUT note that if you type a
in the search box the hotkey is invoked INCORRECTLY and navigates you away to the url of the action.
This is wrong, this should not happen.
I should be able to have hotkeys, but they should not invoke if I am in a search box, text box etc... (They dont invoke, correctly, when Im in a normal input box on my page - they do invoke when the dialog search box has focus - this is incorrect and needs a fix)
Without this fixed, it makes hotkeys unusable if they are single letters like a
are you taking feature requests?
So I have been trying to track this down, if I set my whole Mac to use dark mode, and window.matchMedia("(prefers-color-scheme: dark)").matches
evaluates to true in the JS Console, the dialog is still not correctly setting the dark theme
Replicated on https://cmd-dialog.vercel.app
When lots of items, you search, and the selected item can be randomly in the middle of the list
Hard to explain but after every search, the expectation is that a new list of actions is shown, with the first in the list being highlighted as that is the "most matching" the fuzzy search.
Using your demo as an example, when I search for a
the item highlighted is the last but one search result, and the overflow-y-hidden is near the bottom
When you have lots (Im up to 40+ in mine) items this becomes more of an issue especially if you type one search, then backspace to clear it and then type another, the "relavant" search result is normally at the top of the list, but now I need to scroll up (or arrow up many times) to get to it
I tried to fix this in cmd-dialog.ts
but I just broke it, and was not able then to arrow down to other items :-(
your code:
// Select first result
if (this._results.length > 0 && this._selectedIndex === -1) {
this._selected = this._results[0];
}
// Nothing was found
if (this._results.length === 0) {
this._selected = undefined;
}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.