Improve UX of subject / Content Warning field #362
No reviewers
Labels
No labels
a11y
Bug
Bug fix
Critical Priority
Documentation
Feature
Feature request
Held for next release cycle
High Priority
Low Priority
Medium Priority
Minor change
Translation/Locale
WIP
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: AkkomaGang/akkoma-fe#362
Loading…
Reference in a new issue
No description provided.
Delete branch "hazelnoot/akkoma-fe:develop"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
This PR implements two changes to improve user experience around the Content Warning field.
First, the duplicate emoji button is removed in favor of the main one. State variables are added to record the most recently focused text box. I attempted to preserve the existing code as much as possible, including re-focusing the appropriate input before showing the picker. I'm not sure if that's actually required, but it's consistent with the existing behavior.
Secondly, a "toggle CW" button is added to toggle visibility of the CW field. This respects the "always show subject" and "disable subject" properties, and also ensures that the CW is cleared after hiding the field. The CW field is automatically shown whenever it has a default value, such as replying to a CW-ed post. The toggle CW button is added to the end of the posting controls, right after the polls button. I tested various positions and found that this one looked the best visually.
I think this is partially a duplicate of #293, but I didn't see that PR until after I completed this work. Oh well. 🤷♀️
Before:
After:
By the way, I'm sorry if I missed any important steps! I couldn't find any contributing docs or guidelines.
i like the idea a lot, just one small bug to address and i'll be happy to merge this
thanks!
@ -201,1 +201,4 @@
// When first loading the form, hide the subject (CW) field if it's disabled or doesn't have a starting value.
// "disableSubject" seems to take priority over "alwaysShowSubject"
const showSubject = !this.disableSubject && (statusParams.spoilerText || this.alwaysShowSubject)
this doesn't quite work due to the technicalities of how vue generates component data
this is in
data()
, which runs to generate a bunch of initial data for a componentyou're relying on
computed
values here, which have not actually run at this point, meaning thatalwaysShowSubject
will always be undefined at this point in the lifecycle!if you were to use
this.$store.getters.mergedConfig.alwaysShowSubjectInput
instead, this would resolve correctlygood catch, thank you! I'll push a fix for that.
@floatingghost fixed the bug you found. Thanks for reviewing!
that all works now, thank you very much~