Skip to content

Commit

Permalink
Fixed bug with key binds interfering with <input>s
Browse files Browse the repository at this point in the history
  • Loading branch information
sbdchd committed Nov 4, 2016
1 parent 6c62afd commit 233d9eb
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 2 deletions.
14 changes: 13 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
safari_dir := ./dist/instakeybinds.safariextension
chrome_firefox_dir := ./dist/chrome_firefox_extension
src_zip_dir := ./dist/src_zip_dir

all: chrome_firefox_extension safari_extension bookmarklet
all: chrome_firefox_extension safari_extension bookmarklet src_zip

install:
npm install
Expand All @@ -12,6 +13,17 @@ clean:
bundle:
npm run webpack

src_zip: bundle
mkdir -p $(src_zip_dir)
cp -R src/* $(src_zip_dir)
cp package.json $(src_zip_dir)
cp Makefile $(src_zip_dir)
cp webpack.config.js $(src_zip_dir)
cd $(src_zip_dir) && \
zip src.zip * && \
cd -
mv $(src_zip_dir)/src.zip ./dist/

# Note: chrome and firefox use the same files
chrome_firefox_extension: bundle
mkdir -p $(chrome_firefox_dir)
Expand Down
6 changes: 6 additions & 0 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,12 @@ const nav = navigation();
document.addEventListener('keydown', ev => {
ev.preventDefault;

// don't enable keybinds when input sections like the search bar, add url
// modal, etc. are enabled
if (document.activeElement.tagName.toLowerCase() !== 'body') {
return;
}

const is_key = k => ev.keyCode === k;

// shift + <any_key> doesn't work because clicking + shift results in the
Expand Down
2 changes: 1 addition & 1 deletion src/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

"name": "instakeybinds",
"description": "Keybinds for Instapaper",
"version": "1.0.2",
"version": "1.0.3",
"author": "Steve Dignam",

"homepage_url": "https://github.com/sbdchd/instakeybinds",
Expand Down

0 comments on commit 233d9eb

Please sign in to comment.