mozilla

Revision 48549 of -moz-user-focus

  • Revision slug: CSS/-moz-user-focus
  • Revision title: -moz-user-focus
  • Revision id: 48549
  • Created:
  • Creator: wellington7
  • Is current revision? No
  • Comment Reverted to earlier version; 5 words added, 12 words removed

Revision Content

Used to indicate whether the element can have the focus. By setting this to 'ignore', you can disable focusing the element, which means that the user will not be able to activate the element. The element will be skipped in the tab sequence. A similar property 'user-focus' has been proposed for CSS3.

ignore
The element does not accept the keyboard focus and will be skipped in the tab order.
normal
The element can accept the keyboard focus.

NOTE: -moz-user-focus will not work for textbox. Explanation and workaround follows:

The textbox itself never takes focus. Instead, XBL creates an anonymous XHTML input element inside the textbox, and this is what takes focus. You can stop the textbox taking keyboard focus by setting its tab index to -1, and mouse focus by preventing the default action of mousedown events.

Another approach is to set the textbox to disabled or readonly, depending on why you don't want the textbox to be focused.

(http://stackoverflow.com/questions/4738754/moz-user-focus-doesnt-work/4759201#4759201)

 

 

Revision Source

<p>Used to indicate whether the element can have the focus. By setting this to 'ignore', you can disable focusing the element, which means that the user will not be able to activate the element. The element will be skipped in the tab sequence. A similar property 'user-focus' has been proposed for CSS3.</p>
<dl> <dt>ignore</dt> <dd>The element does not accept the keyboard focus and will be skipped in the tab order.</dd> <dt>normal</dt> <dd>The element can accept the keyboard focus.</dd> <dt> <p><strong>NOTE</strong><strong>:</strong><span style="font-family: 'Times New Roman';"><span style="font-size: small;"> </span></span><span style="font-family: 'Times New Roman';"><span style="font-size: small;"><span style="font-family: 'Courier New'; ">-moz-user-focus</span> will not work for <a href="/en/XUL/textbox" title="https://developer.mozilla.org/en/XUL/textbox">textbox</a>. Explanation and workaround follows:</span></span></p> <blockquote> <p style="margin-top: 0px; margin-right: 0px; margin-bottom: 1em; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; clear: both; word-wrap: break-word; background-position: initial initial; background-repeat: initial initial; "><span style="font-family: 'Times New Roman'; "><span style="font-size: small;">The textbox itself never takes focus. Instead, XBL creates an anonymous XHTML input element inside the textbox, and this is what takes focus. You can stop the textbox taking keyboard focus by setting its tab index to -1, and mouse focus by preventing the default action of mousedown events.</span></span></p> <p style="margin-top: 0px; margin-right: 0px; margin-bottom: 1em; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; clear: both; word-wrap: break-word; background-position: initial initial; background-repeat: initial initial; "><span style="font-family: 'Times New Roman'; "><span style="font-size: small;">Another approach is to set the textbox to disabled or readonly, depending on why you don't want the textbox to be focused.</span></span></p> <p style="margin-top: 0px; margin-right: 0px; margin-bottom: 1em; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; clear: both; word-wrap: break-word; background-position: initial initial; background-repeat: initial initial; "><span style="font-family: 'Times New Roman'; "><span style="font-size: small;">(<a class=" external" href="http://stackoverflow.com/questions/4738754/moz-user-focus-doesnt-work/4759201#4759201">http://stackoverflow.com/questions/4738754/moz-user-focus-doesnt-work/4759201#4759201</a>)</span></span></p> </blockquote> <p> </p>
</dt></dl>
<dl> <p> </p>
</dl>
Revert to this revision