How do I set an accessible name on an unlabeled control?

A customer asked for advice on accessibility. This was great news, because it meant that somebody actually cared about accessibility!

We have a property sheet page that contains an unlabeled list view. The list view is not labeled because its meaning is implied by its placement on the dialog. This works great as long as you can see the screen, but we also need to associate an accessible name to the list view so that screen readers know what it is. We tried Set­Window­Text on the list view, but accessibility didn't pick it up. How do I set the accessibility name on the control?

Place a static control immediately ahead of the list view in the z-order. If you don't want the static control to be visible, mark it as NOT WS_VISIBLE in the dialog template.

This is another manifestation of the trick we learned some time ago of using a hidden static control with an accelerator in order to associate the accelerator key with an unlabeled control. In this case, the hidden static control isn't there to provide an accelerator; it's there to provide an accessible name.

Comments (9)
  1. steveg says:

    It's official: nobody who reads blog cares about accessibility. 7 hours and no comments. I wonder if that's a record?

  2. 640k says:

    People are probably fed up with losing comments because of the lousy blog software.

  3. Maybe the blog software's accessibility isn't that great?

    Should I really leave a question mark as a forward pointer to the next article? :)

  4. Me says:

    First off, I have no clue about the subject so I could be totally wrong…

    Isn't this kind of an implementation dependent hack? Why should a screen reader read hidden controls?

    Imagine a "dynamic" dialog with lots of controls, where only the visibility / layout of the controls are dynamically adapted but the hidden controls always exist. I'm sure such applications exist. Would the screen reader software read out all the controls the user should not see?

    [The screen reader isn't reading the hidden control; it's reading the accName property from the visible control, which MSAA retrieves from the hidden control. -Raymond]
  5. Adam Rosenfield says:

    @Me: If you read the linked-to articles, you'd know that the screen reader software would ignore controls that are disabled (i.e. controls that have the WS_DISABLED style).

  6. MikeCaron says:

    @Me: I think it makes perfect sense:

    If a control's label comes from the preceding label, then it should apply in all cases. If the label is not meant to be displayed, then just make it invisible.

  7. Jcm says:

    Z-order or tab order?

  8. Iain Clarke says:


    Z-order *is* tab order.


  9. @Iain Clarke says:

    In VB you can set different values for z-order and tab order. Why should it be related?

Comments are closed.

Skip to main content