## Implementation Plan: Fix Poll Option Unresponsiveness on Mobile (Android/Chrome) ### Files to Modify 1. **`devplacepy/static/css/engagement.css`** - **Add `touch-action: manipulation`** to the `.poll-option` selector (around line 159–175). - **Add an active state** for immediate visual feedback: ```css .poll-option:not([disabled]):active { background-color: #e0e0e0; /* or a project-appropriate highlight */ } ``` 2. **`devplacepy/static/js/PollManager.js`** - **Replace `click` event with `pointerdown`** (line 8): Change `document.addEventListener("click", (event) => this.onClick(event))` to `document.addEventListener("pointerdown", (event) => this.onClick(event))`. This directly fixes the Chrome Android synthetic click retargeting because `pointerdown` fires on the actual touched element and is not retargeted. - **Prevent double-firing** by adding a guard: inside `onClick`, check if the event already triggered a vote (e.g., store the last target in a `WeakSet` or use a timestamp debounce). For simplicity, add a reusable check at the top of `onClick`: ```js if (event.detail === 0) return; // ignore synthetic click events ``` - **Fix silent failure on session expiry** (line 45): Change the call from `this.submit(url, params, null, render)` to `this.submit(url, params, this.pollContainer, render)` where `this.pollContainer` is stored during initialization (e.g., the `poll-vote` or `poll-section` element). - In the constructor, add `this.pollContainer = document.getElementById('poll-container') || document.querySelector('.poll-section');` (adjust selector as needed). ### Definition of Done - [ ] The CSS file `engagement.css` has `touch-action: manipulation` on `.poll-option` and a non-disabled `:active` style. - [ ] The JS file `PollManager.js` uses `pointerdown` instead of `click` and includes a guard to avoid double processing. - [ ] `PollManager.vote()` passes a valid DOM element (not `null`) as the `errorTarget` argument. - [ ] All changes are committed and the project’s test command passes: `pip install -e '.[dev]' -q && make test-unit` (If PEP 668 blocks system installs, use a virtual environment or set `PIP_REQUIRE_VIRTENV=0` or append `--break-system-packages`.) - [ ] All changes pass the project’s lint command: `pip install -q ruff && ruff check .` - [ ] No regressions in existing poll functionality on desktop and non-Chrome browsers (the `pointerdown` event works identically for mouse clicks on desktop).