• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Focus Rings
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Focus Rings


  • Subject: Re: Focus Rings
  • From: Ricky Sharp <email@hidden>
  • Date: Mon, 9 Jul 2007 20:53:48 -0500


On Jul 9, 2007, at 8:16 PM, Keith Duncan wrote:

I've been working on more custom controls and wasn't sure when it is appropriate to draw a focus ring. Is it just when the control accepts keyboard input? I suspect it is but I've searched the HIG which didn't help much.

Perhaps someone could point me to a link that covers focus rings.

For all my custom controls, I implement acceptsFirstResponder, needsPanelToBecomeKey and canBecomeKeyView:


- (BOOL)acceptsFirstResponder
{
    return YES; // I always return yes here
}

- (BOOL)canBecomeKeyView
{
return [self isEnabled]; // Conditionally return YES (based upon certain criteria)
}


- (BOOL)needsPanelToBecomeKey
{
    return <some flag>
}

For the last API, I only return YES if the control will always accept keyboard input regardless of whether or not full keyboard access is enabled. For example, lists and edit fields.

In the control's cell, I then draw the focus ring if showsFirstResponder returns YES.

And, in IB, I always wire up all participating controls in the keyboard loop.

This simple setup does the right thing whether or not full keyboard access is enabled. And, if accessibility is important to you, it will lay part of the foundation for stuff like VoiceOver's "keyboard focus tracks VoiceOver cursor" feature.

___________________________________________________________
Ricky A. Sharp         mailto:email@hidden
Instant Interactive(tm)   http://www.instantinteractive.com

_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >Focus Rings (From: Keith Duncan <email@hidden>)

  • Prev by Date: Re: New Finder
  • Next by Date: Re: Languages supported by OS X?
  • Previous by thread: Focus Rings
  • Next by thread: Re: New Finder
  • Index(es):
    • Date
    • Thread