Remove zero width space special case from public API
- Dominant language
- Python
- Stars
- 5.4k
- Forks
- 827
- Avg merge
- 15h 39m
- Merged PRs (30d)
- 40
Description
Label, Switch and Button all document their `text` property as follows:
> `None`, and the Unicode codepoint U+200B (ZERO WIDTH SPACE), will be interpreted and returned as an empty string. Any other object will be converted to a string using `str()`.
The zero width space special case was added for the benefit of WinForms, where some of these widgets will collapse their height if you give them an actual empty string.
However, there's no need for this implementation detail to complicate the public API. We should follow the same principle as we have on other widgets such as Slider, where if a backend is unable to round-trip a value, then it sets the native value to the best possible approximation, and caches the “true” value so it can be returned to the interface layer unchanged.
Contributor guide
Research direction
Start by locating the text-property implementations and documentation for Label, Switch, and Button, then compare them with Slider's value handling. Review the relevant backend behavior for values that cannot round-trip. Done means the public API no longer documents or applies a ZERO WIDTH SPACE special case while native backends still preserve usable widget sizing.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- desktop
- Issue type
- Refactor
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100