WtecHtec / ext-shoot

a blazingly fast extension launcher for browser
6 stars 1 forks source link

唤起cmdk面板后,按键监听操作应该拦截传导,不影响原来的网页 #7

Closed Leizhenpeng closed 8 months ago

Leizhenpeng commented 8 months ago

https://github.com/WtecHtec/ext-shoot/assets/50035229/da16c615-af3f-42b7-950e-f05234eeaced

看到github上在唤起cmdk之后,按键继续影响了原网页

WtecHtec commented 8 months ago

部分页面监听了keydown事件,尝试阻止冒泡、捕获

WtecHtec commented 8 months ago

npm i dom-focus-lock 可用这个解决

WtecHtec commented 8 months ago

阻止 input输入: function inputListener (event) { // 阻止事件冒泡 event.stopPropagation(); }

Leizhenpeng commented 8 months ago

禁止的有些过度,cmd+k 也无法使用了哈哈

Leizhenpeng commented 8 months ago

npm i dom-focus-lock 可用这个解决

这个有效吗~,看起来满符合这个issue的痛点哈哈