Blocking invalid self-intersecting shape/line
- Dominant language
- TypeScript
- Stars
- 38
- Forks
- 22
- PR merge metrics
- No merged PRs in 30d
Description
### Description
When a data collector is creating a shape that self-intersects, we want to display an error, so they can't submit an invalid polygon.
Initially we were thinking we would display the constraint message in the snackbar, like we are [planning with Collect](https://forum.getodk.org/t/blocking-invalid-self-intersecting-polygons-in-collect/57009), but we are going to leverage the existing error handling as a starting point.
[Spec doc ](https://docs.google.com/document/d/1S6nIfd5XZoljteQLdMtJe7NjmrxTFWfFmUD6REohaAE/edit?tab=t.zbhfz7ian44s)for reference.
---
### Checklist
- **Does it need UI/UX design?**
- [X] Yes. Describe the UI/UX requirements or attach a Figma link in the "Design" section.
- [ ] No
- **Does it need API design?**
- [ ] Yes. Specify the endpoints, methods, or data structures needed.
- [ ] No
- **Does it need design around state flow?**
- [ ] Yes. Outline the state flow requirements.
- [ ] No
- **Does it need a test plan?**
- [ ] Yes. Add the test plan as a comment in this task or attach the document.
- [ ] No
---
### User Stories
- **As a** data collector capturing a shape
**I want** to know when I've created a self-intersecting polygon
**so that** so that I can fix it when it happens rather than after I'm finished when I may not have context
- Given I have a form with a geotshape/trace question
And it has the parameter incremental=true
And it has a constraint
When I navigate to the question
And add points so that the constraint is violated
Then the **polygon changes colour to red**
- Given I have a form with a geotrace/shape question
And it has the parameter incremental=true
And it has a constraint
When I navigate to the question
And add points so that the constraint is violated
And I remove the point that violated the constraint
Then the **polygon changes colour back to blue**
- Given I have a form with a geotrace/shape question
And it has the parameter incremental=true
And it has a constraint
When I navigate to the question
And add points so that the constraint is violated
And I remove the point that violated the constraint
Then the **error constraint message goes away**
---
### Design
- **[Figma](https://www.figma.com/design/6v0NnvayfDlaQhYpjv37Bn/ODK-Web-Forms?node-id=3644-23626&t=TVRbd5KZnbscg32x-1)**
---
### Additional Notes
-
---
### Related Issues
-
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by reviewing the existing error-handling path for geotrace/geoshape questions, then consult the linked Figma design and spec document. Done means incremental self-intersecting polygons turn red and show the constraint error, and return to blue with the error removed after the violating point is removed.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- frontend
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100