3 ms·
Why doesn't my down arrow key work on this page?
by bangonkeyboard 6y ago
Why doesn't my down arrow key work on this page?
- saagarjha 6y agoblog.google breaks it, as has been noted before: https://news.ycombinator.com/item?id=22949003 https://news.ycombinator.com/item?id=22949003
- bangonkeyboard 6y agoFound it. In https://www.blog.google/static/blogv2/js/all.js?version=4.3 https://www.blog.google/static/blogv2/js/all.js?version=4.3 {key:"onKeyDown",value:function(t){var e=t.preventDefault;this.isToggle(document.activeElement)?(e(),!this.header.isKebabOpen&&this.header.openKebab(),this.getFirstLink().focus()):this.isLastLink(document.activeElement)?this.isLastLink(document.activeElement)&&e():(e(),this.focusNextLink())}} There's a logic error in the nested ternaries: event.preventDefault() is called in every branch. Fixed: {key:"onKeyDown",value:function(t){var e=t.preventDefault;this.isToggle(document.activeElement)?(e(),!this.header.isKebabOpen&&this.header.openKebab(),this.getFirstLink().focus()):this.isLink(document.activeElement)&&(e(),!this.isLastLink(document.activeElement)&&this.focusNextLink())}}