dotnet / winforms

Windows Forms is a .NET UI framework for building Windows desktop applications.
MIT License
4.4k stars 976 forks source link

[Accessibility] A control can have many tooltips #2897

Closed vladimir-krestov closed 1 year ago

vladimir-krestov commented 4 years ago

Problem description:

Expected behavior:

Minimal repro:

weltkante commented 4 years ago

I don't agree on the expected/unexpected part, this is how the implementation is designed to work, unless the entire design is revisited I'd rather resolve this on the documentation side.

In particular this is not a bug, it is an inherent part of how the component model is expected to work. Tooltip is a component which is supposed to be added to the component collection of a container (usually through the designer). How it works is that the tooltip is an IExtenderProvider which extends other controls on the same container by additional properties, indicated by the [ProvideProperty("ToolTip", typeof(Control))] attribute. It is reasonable to expect that multiple designer components are independent of each other, in fact the implementation of tooltips relies on this to prevent memory leaks. The only reason why you'd want to have multiple tooltip components is because you want granular control over the lifetime of the tooltips, so you can unload one tooltip set while keeping another. Having a tooltip component per form for example allows to garbage collect the tooltips together with the form.

I'm not saying you shouldn't implement the requested change, but IMHO it would be better served by a redesign of tooltips as a whole rather than retrofitting the "expected behavior" from OP into the current implementation - e.g. why should I even have to instantiate tooltip components when they are going to coordinate a singleton implementation anyways? As it is the current behavior exactly matches what you would expect from the component model.

merriemcgaw commented 4 years ago

Perhaps we can consider this issue as a part of the redesign of tooltips as part of supporting WCAG2.1. We know there will be changes there to support hoverable, dismissible and persistent requirements that are being added by WCAG2.1. So this seems like a good time to evaluate the entire model. Definitely something we can consider.

Tanya-Solyanik commented 1 year ago

@merriemcgaw - do we still want to consider this issue?

merriemcgaw commented 1 year ago

Customer can use a multi line tool tip if they need multiple lines. We will consider once there's a customer request as this was internal find.