Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(187)

Issue 11038035: Avoid capture of 's' in dartdoc search input. (Closed)

Created:
8 years, 2 months ago by Johnni Winther
Modified:
8 years, 2 months ago
Reviewers:
Jennifer Messerly
CC:
reviews_dartlang.org, sethladd
Visibility:
Public.

Description

Avoid capture of 's' in dartdoc search input. Committed: https://code.google.com/p/dart/source/detail?r=13228

Patch Set 1 #

Total comments: 4
Unified diffs Side-by-side diffs Delta from patch set Stats (+10 lines, -2 lines) Patch
M pkg/dartdoc/lib/src/client/dropdown.dart View 2 chunks +10 lines, -2 lines 4 comments Download

Messages

Total messages: 3 (0 generated)
Johnni Winther
TBR 'Unbreaks' dartdoc/apidoc.
8 years, 2 months ago (2012-10-04 13:07:32 UTC) #1
Jennifer Messerly
https://codereview.chromium.org/11038035/diff/1/pkg/dartdoc/lib/src/client/dropdown.dart File pkg/dartdoc/lib/src/client/dropdown.dart (right): https://codereview.chromium.org/11038035/diff/1/pkg/dartdoc/lib/src/client/dropdown.dart#newcode325 pkg/dartdoc/lib/src/client/dropdown.dart:325: bool searchInputFocused = false; this works, but there are ...
8 years, 2 months ago (2012-10-04 20:31:17 UTC) #2
Johnni Winther
8 years, 2 months ago (2012-10-05 12:51:37 UTC) #3
https://codereview.chromium.org/11038035/diff/1/pkg/dartdoc/lib/src/client/dr...
File pkg/dartdoc/lib/src/client/dropdown.dart (right):

https://codereview.chromium.org/11038035/diff/1/pkg/dartdoc/lib/src/client/dr...
pkg/dartdoc/lib/src/client/dropdown.dart:325: bool searchInputFocused = false;
On 2012/10/04 20:31:17, John Messerly wrote:
> this works, but there are a few other ways that might be cleaner.
> 
> One option is to listen for keyDown on document instead of window. They you
get
> normal bubbling order, in particular the focused element will get keys first.
> This is illustrated below.
> 
> An even easier way is to replace "searchInputFocused" with "event.target ==
> searchInput"
> 
> 
> <!doctype html>
> <html>
> <head>
> </head>
> <body>
>   <input id="q" placeholder="hello there"></input>
>   <script type="application/dart">
> #import('dart:html');
> 
> /** Activate search on Ctrl+3 and S. */
> void shortcutHandler(KeyboardEvent event) {
>   print('shortcutHandler got ${event.keyCode}');
>   if (event.keyCode == 0x33/* 3 */ && event.ctrlKey ||
>       event.keyCode == 0x53/* S */) {
>     query('#q').focus();
>   }
> }
> 
> void inputHandler(Event event) {
>   print('inputHandler, value is ${query('#q').value}');
> }
> 
> void main() {
>   document.on.keyDown.add(shortcutHandler);
>   query('#q').on.input.add(inputHandler);
> }
>   </script>
>   <script>navigator.webkitStartDart();</script>
> </body>
> </html>

Thanks. I've put this is in https://codereview.chromium.org/11036058/.

https://codereview.chromium.org/11038035/diff/1/pkg/dartdoc/lib/src/client/dr...
pkg/dartdoc/lib/src/client/dropdown.dart:345: searchInput.on.focus.add((event)
=> searchInputFocused = true);
On 2012/10/04 20:31:17, John Messerly wrote:
> with changes described above, you won't need these two lines

Done.

Powered by Google App Engine
This is Rietveld 408576698