Address unreliable text editing in Breaking News Tool
What's changed?
This PR attempts to address #1875. In particular, when text is completely removed from the headline input it should not then reappear with the default, it should stay empty. The placeholder text has also be changed from the CAPI headline to the "Enter headline..." which goes for other text inputs on cards too.
| Situation | GIF |
|---|---|
| Before | |
| After |
Implementation notes
I found implementing this fairly tricky, in particular the edge case of a headline being saved as an empty string. Ideally you shouldn't be able to save the text as empty, but there doesn't seem to be a provision for this in the code.
Currently if a user sets the headline to empty in the clipboard and hits save they will see "No headline!", if they refresh the page it will return to the value from CAPI. If they do this in a collection, the headline is replaced by the CAPI value.
I think this an acceptable solution as I can't see any obvious footguns. I'm open to suggestions on this.
Checklist
General
- [ ] 🤖 Relevant tests added
- [x] ✅ CI checks / tests run locally
- [ ] 🔍 Checked on CODE
Client
- [x] 🚫 No obvious console errors on the client (i.e. React dev mode errors)
- [ ] 🎛️ No regressions with existing user interactions (i.e. all existing buttons, inputs etc. work)
- [ ] 📷 Screenshots / GIFs of relevant UI changes included
Tested locally , works well. 👍🏼 . Just checking , in case the headline is fully deleted, and on clicking 'Save edits' it would show 'No headline!'. But this would be reverted back to the original headline on refreshing tha page . Also dragging and dropping the clipboard copy with 'No headline' to any regional container would cause the original headline to reappear. That's the expected behaviour ?
That's correct. The behaviour is slightly quirky, but hopefully an edge case and an general improvement to the expected user behaviour. I'll put together some comms ahead of release to ensure CP are aware of the oddness.
Seen on PROD (merged by @SHession 6 minutes and 3 seconds ago) Please check your changes!