admin管理员组

文章数量:1314442

If you're in the latest version of Chrome, or in a Webkit nightly build, you'll notice that password fields have a nice new caps lock indicator baked right into the browser itself.

As far as I can tell, there does not appear to be any style changes related to this indicator. As such, I am having no luck finding a way to disable it, as our pany uses a styled JavaScript solution for cross-browser caps-lock indicators.

Does anyone know of a way to disable this indicator in Webkit browsers?

If you're in the latest version of Chrome, or in a Webkit nightly build, you'll notice that password fields have a nice new caps lock indicator baked right into the browser itself.

As far as I can tell, there does not appear to be any style changes related to this indicator. As such, I am having no luck finding a way to disable it, as our pany uses a styled JavaScript solution for cross-browser caps-lock indicators.

Does anyone know of a way to disable this indicator in Webkit browsers?

Share Improve this question asked Nov 5, 2012 at 19:23 user1191002user1191002 5
  • Does -webkit-appearance: none or textfield solve anything? I don't have a browser to test, but that's my best guess. – apsillers Commented Nov 5, 2012 at 19:32
  • that's what i would suggest as per quackit./css/properties/webkit/css_-webkit-appearance.cfm – user428517 Commented Nov 5, 2012 at 19:35
  • @apsillers Nope. This appears to not be set via any webkit style attributes. – user1191002 Commented Nov 5, 2012 at 19:45
  • What version exactly, and what OS? I just looked at Chrome Canary (25) and the latest nightly Chromium on Windows 7 and couldn't get a caps lock indicator to e up on password fields. – josh3736 Commented Nov 5, 2012 at 19:50
  • @josh3736 Interesting. I'm on OSX and it shows in Chrome 22, Chrome Canary 23, and last night's Webkit nightly build. So I assume the next build of Safari will also have this present. – user1191002 Commented Nov 5, 2012 at 19:59
Add a ment  | 

4 Answers 4

Reset to default 5

Adding a caps lock indicator to password text inputs is actually a feature of Mac OS X, not something specific to Chrome/Webkit. In Windows and Linux versions of Chrome, there is no caps lock indicator.

I did find that adding display: block to the password field caused the indicator to go away in both Chrome and Safari. However, given the fact that display has absolutely nothing to do with a caps lock indicator, I'd consider this an implementation detail (borderline bug) that is likely to be fixed in the future.

for what is worth 5 yrs later, I've solved it by setting

input::-webkit-caps-lock-indicator {
    content: none;
}

Might not be the cleanest solution but does the job;

The feature is not scriptable from JavaScript. It's inside the browser code itself. There may be a setting in the browser for it, but web pages have zero control over it.

I think looking at -webkit-appearence: caps-lock-indicator could help you to solve this issue.

本文标签: javascriptDisable caps lock indicator on Webkit browsersStack Overflow