Title: Focus: defer focus border until first directional navigation by bitcoin3us · Pull Request #173 · MicroPythonOS/MicroPythonOS · GitHub
Open Graph Title: Focus: defer focus border until first directional navigation by bitcoin3us · Pull Request #173 · MicroPythonOS/MicroPythonOS
X Title: Focus: defer focus border until first directional navigation by bitcoin3us · Pull Request #173 · MicroPythonOS/MicroPythonOS
Description: Make add_focus_border() (mpos/ui/focus.py) skip the focus ring on pointer/touch devices. Why add_focus_border() draws a focus highlight and adds the widget to the default focus group — a navigation aid for keypad/encoder devices, where it shows which widget the moving highlight is on. On a pointer/touch UI there is no moving highlight: the ring only appears after a tap and then lingers around the tapped widget. Concretely, this is why the Lightning Piggy balance shows a gold rectangle after you tap it (the balance is add_focus_border-ed in 0.6.0, and tapping it cycles the denomination). On a touchscreen that ring is visual noise, not a cue. What def add_focus_border(widget, ...): from .input_manager import InputManager if InputManager.has_pointer(): return ... Reuses the existing InputManager.has_pointer() (no new detection). Full no-op on touch: skips both the FOCUSED/DEFOCUSED border callbacks and the focus-group registration. Widgets remain interactive through their own CLICKABLE flag / click handlers, which are independent of the focus group. Keypad/encoder devices are unchanged — has_pointer() is False there, so the border is added exactly as before. Hybrid devices (both touch and a keypad) would also skip the ring; that edge case can be refined later if needed — flagging it explicitly rather than silently. Testing tests/test_focus_border_touch.py added: asserts add_focus_border() registers no callbacks when InputManager.has_pointer() is patched True. Verified the logic in a CPython stub harness (lvgl + InputManager stubbed): touch present → 0 callbacks (no-op); no pointer → 2 callbacks registered. Confirmed InputManager.has_pointer() returns True on a real touchscreen device (ESP32-S3), so the guard fires there. ⚠️ I did not run ./tests/unittest.sh locally — it needs a freshly built desktop binary with this change and my local build is stale. Please run ./tests/unittest.sh tests/test_focus_border_touch.py in CI / on a current build. Merge checklist CHANGELOG: ✅ added under Future release → Frameworks App version / MANIFEST: n/a (framework change) MAINTAINERS.md / boards: n/a Settings migration: n/a Unit tests: ✅ added (no-op path); see testing caveat above Frameworks docs (docs.micropythonos.com): not updated — add_focus_border behavior is now device-conditional; happy to add a note if there is a docs page for it.
Open Graph Description: Make add_focus_border() (mpos/ui/focus.py) skip the focus ring on pointer/touch devices. Why add_focus_border() draws a focus highlight and adds the widget to the default focus group — a navigation...
X Description: Make add_focus_border() (mpos/ui/focus.py) skip the focus ring on pointer/touch devices. Why add_focus_border() draws a focus highlight and adds the widget to the default focus group — a navigation...
Opengraph URL: https://github.com/MicroPythonOS/MicroPythonOS/pull/173
X: @github
Domain: github.com
| route-pattern | /:user_id/:repository/pull/:id/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:532c37ce-b8b9-c63d-7083-2d62b70ecdd1 |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | C96E:1694AE:12FDC6C:19FE35F:6A5219DC |
| html-safe-nonce | 8a4595841a3644248127b83c7ae658af971a82f62ca6fa95663295a8df750ca4 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDOTZFOjE2OTRBRToxMkZEQzZDOjE5RkUzNUY6NkE1MjE5REMiLCJ2aXNpdG9yX2lkIjoiMzA4MDk4MzA0OTEyODc3ODIwNCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | f7f53bf51b4eca3267fe0b2c5cf1bcf8a965f6fe7a445d52e4388939aec769d8 |
| hovercard-subject-tag | pull_request:3938026426 |
| github-keyboard-shortcuts | repository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/MicroPythonOS/MicroPythonOS/pull/173/files |
| twitter:image | https://avatars.githubusercontent.com/u/115934595?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/115934595?s=400&v=4 |
| og:image:alt | Make add_focus_border() (mpos/ui/focus.py) skip the focus ring on pointer/touch devices. Why add_focus_border() draws a focus highlight and adds the widget to the default focus group — a navigation... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | b9a586c06a05a7a86fc7e3f4dbd03e42f6869085879aa184aa6369456dbd50fb |
| turbo-cache-control | no-preview |
| diff-view | unified |
| go-import | github.com/MicroPythonOS/MicroPythonOS git https://github.com/MicroPythonOS/MicroPythonOS.git |
| octolytics-dimension-user_id | 213598128 |
| octolytics-dimension-user_login | MicroPythonOS |
| octolytics-dimension-repository_id | 975472483 |
| octolytics-dimension-repository_nwo | MicroPythonOS/MicroPythonOS |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 975472483 |
| octolytics-dimension-repository_network_root_nwo | MicroPythonOS/MicroPythonOS |
| turbo-body-classes | logged-out env-production page-responsive full-width |
| disable-turbo | true |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 7aed05249554b889eb33d002851a973eebcc7e91 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width