Also related: Issue 27559
Another note: What clearly *is* a bug that needs fixing is that Ctrl-W
doesn't even fire the "unbeforeunload" event, so my application can't even
ask the user if he/she wants to save the currently open file(s). That makes
this problem even more cynical... ;)
You're sure that typo isn't copied from your code? "unbeforeunload" should
be "onbeforeunload" right?
Also note that in addition to Ctrl-NTW, I second the OP's inclusion of
Ctrl-Tab, and Shift-Ctrl-Tab.
Offense intended, but you've really pissed me off as a developer. Thanks,
Chrome.
This severely needs to be modified, Chrome has no right to override a web
app.
You can't expect us to build desktop class web applications if you
purposely go skrewing around with the tools we need to create them.
As I mentioned earlier, adding a Javascript API extension which app
developers are required to call before they can capture all keys would
solve all of the unresponsive script problems.
If we're really worried about malicious use, then we can make a Allow/Deny
prompt like the one which is used for location data.
Thanks!
@Tomasz:
"Of course you want Ctrl+N to open a new window. Except when you're using
vim in your browser"
"there are some legitimate uses where the benefits outweigh the
disadvantages."
The problem is that if it's allowed then it won't only be used on a few
sites where it might possibly make sense but also in places where it
doesn't make sense, or where users aren't expecting it to be used. By
disallowing it users are guaranteed to have consistent keyboard shortcuts
that they can rely on. It's only going to frustrate people when they try a
site out and then find it's overriden the shortcuts.
@Tomasz,
"Ctrl+W is rarely used (Alt+F4 is much more popular)"
I use Ctrl+W all the time to close the current tab. I'm sure a large
proportion of users do too. Alt+F4 would close the entire window so I'm not
sure why you're comparing them.
F**k Crome! not good for web developers
@sam.hasler: But if users would have to give permission to sites via
prompt, then there will always be the expectation by the user that these
shortcuts will be used by the website. There would never be an instance
where a site could map these shortcuts without confirmation by the user.
To be completely honest, I'm fairly certain the number of people who use
Ctrl+W is extremely small. I use it every so often, but ordinary users,
the type of user who the devs are concerned with, likely very rarely use it.
@Sam:
"The problem is that if it's allowed then it won't only be used on a few
sites where it might possibly make sense but also in places where it
doesn't make sense, or where users aren't expecting it to be used."
1. Maybe I haven't thought about it long enough, but I don't think it's
something that would be commonly abused. Who would want to override
Ctrl+WNT without a good reason? (So far I haven't seen any examples,
although it is possible in IE & Firefox.)
2. The fact that a feature can theoretically be used in a frustrating way
is not a sufficient reason to disable it. For example, I am frustrated by
sites that show you an annoying "Are you sure you want to leave the site?"
popup when you try to close them. But I don't believe that this feature
should be removed from browsers, because it can be useful in many cases.
Similarly, I could rewrite your argument to argue that websites should not
be able to set the color of hyperlinks: "If we allow them to do that, they
will use it not only in ways that make sense, but also in ways that don't
make sense (e.g. making links hard to distinguish from regular text). By
disallowing it users are guaranteed to have a consistent hyperlink look
that they can rely on."
3. In my opinion, browsers should try to offer as many features as
possible, unless it is demonstrated that for the average user, a particular
feature causes more harm than good (example: javascript pop-ups). In the
case at hand, it has not been demonstrated. There's just general "but what
if websites use it wrong?" talk.
@Tomasz,
> Similarly, I could rewrite your argument to argue that websites should
> not be able to set the color of hyperlinks: "If we allow them to do that,
> they will use it not only in ways that make sense, but also in ways that
> don't make sense (e.g. making links hard to distinguish from regular
> text). By disallowing it users are guaranteed to have a consistent
> hyperlink look that they can rely on."
The colour of hyperlinks only affects how that website looks. Overriding
shortcuts for browser behaviour can affect the user when they aren't paying
attention to which tab they are on. e.g.:
a) with focus on the rightmost tab, trying to close the last 3 tabs, with
the middle of those overriding CTRL+W.
The annoying "Are you sure you want to leave the site?" popup at least
provides some feedback as to that is going on. If a site overrides CTRL+W
because it doesn't want to make it easy for users to leave there would be
no indication that the site had done it and the user may attribute blame to
chrome.
b) Switching to the browser with ALT+TAB and then trying to open a new
window or tab with CTRL+T/N
c) Moving through the tabs with CTRL+TAB
"browsers should try to offer as many features as possible" that is
completely opposite to how chrome was designed. They have tried to remove
as many settings and choices from the user as possible by picking sensible
defaults or designing it in such a way that there is no need for the user
to make a choice.
Maybe the browser window itself shouldn't allow resetting those shortcuts
but what about apps? If you have only the app-window shortcuts like
Ctrl+Tab or Ctrl+W are (at least in my opinion) not considered critical so
allowing the app to override would be a pretty nice feature..
@Nick:
A user dialog would certainly solve the problem, but isn't there a simpler
solution? What happens if you put some expensive JS in an onbeforeunload
handler, and then try to close the tab? How does Chrome handle it?
One idea is that the browser could give the webpage a certain small amount
of time to handle a keystroke and, if there's no reaction, close the tab.
I'm a heavy keyboard user and almost exclusively use ctrl+w to close tabs
in practically all applications I use (most notably browser & eclipse). I'm
building a web application that initially targeted firefox/chrome, but it
also uses tabs on the page itself. I want to support what users (including
myself) are used to, which is ctrl+w to close a tab in the web application.
That said, I refuse to remap the default combination to something no one is
used to.
Removing the ability to intercept it because of malicious uses is absurd as
in all my years of firefox browsing only one thing has bugged me with such
an issue: flash; not some javascript application. Luckily we have this
magical device called a "mouse" that can sidestep such malicious brilliance.
Additionally I would like to emphasize that as mentioned above, only
advanced users tend to use keyboard shortcuts which means malicious sites
have little to gain by blocking these. Unlucky for me perhaps that the
advanced users are my target audience for this web application. Well
there's always firefox ey?
Could somebody confirm that this issue also applies to CTRL+mousewheel?
Chrome seems to execute default page zooming instead of specific JS code no
matter what I try.
Thanks