Skip to content

[stable9.0] Fix sim digitalReadPin and make digital pins toggle switches (#7117) - #7121

Open
Robert Knight (microbit-robert) wants to merge 1 commit into
microsoft:stable9.0from
microbit-robert:stable9.0-digital-pins
Open

Robert Knight (microbit-robert) wants to merge 1 commit into
microsoft:stable9.0from
microbit-robert:stable9.0-digital-pins

Conversation

@microbit-robert

Copy link
Copy Markdown
Contributor

#6795 limited digital input pins to values 0/1 for keyboard and screen reader support, but digitalReadPin still required a value above 100, so it always returned 0. The new click mapping also meant that only the top of the pin set it high, which on the small edge pins was under 10% of the pin's height.

Read a digital pin as high for any value above 0, matching how the pin is displayed.

Clicking a digital input pin now toggles it between 0 and 1, wherever on the pin it is clicked. To match, digital pins are exposed to assistive technology as role="switch" with aria-checked rather than as a 0-1 slider, and Space and Enter toggle them. Arrow keys still work.

The toggle happens on click rather than pointerdown so that screen readers in browse mode, which activate a switch by dispatching a click, can toggle it. Analog pins remain sliders and touch pins remain buttons.

Fixes #7093

This is a cherry-pick of #7117 from master (applied cleanly). We've had several support tickets about this issue, so it would be great to get it live. Feel free to edit the PR to match your conventions, or close it and cherry-pick it yourselves.

…ft#7117)

microsoft#6795 limited digital input pins to values 0/1 for keyboard and screen
reader support, but digitalReadPin still required a value above 100, so
it always returned 0. The new click mapping also meant that only the
top of the pin set it high, which on the small edge pins was under 10%
of the pin's height.

Read a digital pin as high for any value above 0, matching how the pin
is displayed.

Clicking a digital input pin now toggles it between 0 and 1, wherever
on the pin it is clicked. To match, digital pins are exposed to
assistive technology as role="switch" with aria-checked rather than as
a 0-1 slider, and Space and Enter toggle them. Arrow keys still work.

The toggle happens on click rather than pointerdown so that screen
readers in browse mode, which activate a switch by dispatching a click,
can toggle it. Analog pins remain sliders and touch pins remain
buttons.

Fixes microsoft#7093
@microbit-matt-hillsdon

Copy link
Copy Markdown
Contributor

Gentle nudge on this one, would be great to see this fix in live.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants