-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use mudder to rank form elements and related pub values #996
Conversation
44bac3f
to
eaf5f37
Compare
eaf5f37
to
68406d1
Compare
* chore: set log level=debug * chore: try removing healthcheck * chore: add healthcheck back * chore: attach false maybe * chore: really not sure * chore: try removing minio-init * chore: empty test commit
you are a hero |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good and works well! i made a few suggestions on improving keyboard accessibility and styles, which i think would be good to get in, and a very minor one about code organization which is not necssary. i don't think i tested every possible permutation, but it seems very stable, great work!
@@ -63,22 +67,24 @@ export const FormElement = ({ element, index, isEditing, isDisabled }: FormEleme | |||
removeElement(index); | |||
}} | |||
> | |||
<Trash size={24} className="text-neutral-400 hover:text-red-500" /> | |||
<Trash size={24} className="!pointer-events-auto text-neutral-400 hover:text-red-500" /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hmm, no, i just applied the latest updates from shadcn there, not sure why they chose to do that.
but you could solve this problem slightly differently, by adding [&_svg]:hover:text-red-500
to the button above. this is slightly nicer i think, as the trash icon turns red if you hover the button, not just the icon
imagine the tip of this arrow being the tip of the hand pointer (can't capture my mouse grrr)
disabled={isDisabled || element.deleted} | ||
variant="ghost" | ||
className="invisible p-2 group-hover:visible" | ||
className="invisible p-2 group-hover:visible group-focus:visible" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you could fix it by giving things explicit tabIndices, using opacity instead of visibility, and using focus within.
some of these might be redundant, but ill leave comments which should give a setup like so
Screen.Recording.2025-03-05.at.13.33.14.mov
disabled={isDisabled || element.deleted} | ||
variant="ghost" | ||
className="invisible p-2 group-hover:visible" | ||
className="invisible p-2 group-hover:visible group-focus:visible" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so great you made keyboard accessibility work!
it is a bit... strange, it seems that after reordering the tabindex does not per se change (which is understandable, i think?). ends being a strange experience reordering a bunch of items
Screen.Recording.2025-03-05.at.13.20.23.mov
name: string, | ||
slug: string, | ||
communityId: CommunitiesId, | ||
isDefault: boolean, | ||
trx = db | ||
) => { | ||
const ranks = mudder.base62.mudder(pubType.fields.length + 1); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hahaha wow that would be kind of sick.
i think for inserts this is no problem at all
Co-authored-by: Thomas F. K. Jorna <[email protected]>
Ok this is finally fixed up. There were some more complications with the form builder keyboard accessibility (that were affecting tests) and I also realized it was possible to do the pub value sorting entirely in the database, so I fixed that. I also had to fix the |
* Add ranks to form elements * Add rank to pub values * Set rank for form elements with mudder when creating new forms * Use mudder rank instead of order in form builder * Fix test expectation * Sort pub values by rank * Fix bugs in related value ranking * Fix form builder sort bugs * Pass transaction to getPubType * Fix off by one error * Condense migrations * Set collation order at field level rather than on query * Improve form builder readability * Cleanup * Make keyboard interactions work on sortable form elements * Fix missing hover state on form elements delete/restore buttons * Add test for form element sorting * Set config.label on element creation for proper default label * Actually show label changes in form builder * Set default label correctly for relationship elements * Set correct input component for relationship fields on form creation * Set default config.label when adding a new element to a form * Make sure config.relationshipConfig.component is set for relationship form elements * Update test now that label updates are actually reflected in the form builder * Improve UX for adding relationship form element Clicking edit on a newly added (not saved to the db) field, then clicking cancel will no longer delete the element. That will only happen if you click cancel immediately after adding the new element. The save button in the form element panel will always be enabled when first configuring a new field input element. Previously the only way to add a new relationship field without making an unnecessary config edit was to click the x, since the Save button was disabled and the cancel button would remove the element from the form. * Prevent fallback to bad slug value when rendering unconfigured relationship field * Make sure mudder table in migrations is 0 indexed * chore: PR preview fixes (#1021) * chore: set log level=debug * chore: try removing healthcheck * chore: add healthcheck back * chore: attach false maybe * chore: really not sure * chore: try removing minio-init * chore: empty test commit * Sort get pubs result in js * Fix merge mistake * Add ranks to values in datacite test * Allow tabbing to form element buttons Co-authored-by: Thomas F. K. Jorna <[email protected]> * Fix arcadia seed * Remove unnecessary sorting * Sort pub values in the database * Remove rank from returned values * Update tests to ignore return order of pub values * Update sort test to account for new drag handle setup --------- Co-authored-by: Eric McDaniel <[email protected]> Co-authored-by: Thomas F. K. Jorna <[email protected]>
Issue(s) Resolved
#963
High-level Explanation of PR
This PR:
form_elements.label
for every element on form creation or when a new element is added to a form. This shouldn't change what gets rendered in the form itself because we also check theform_elements.label
at that point, but this change means the default label will be populated in the element config form on the form builder.relationBlock
when creating a relationship element during initial form creation and when adding a new relationship form element to a form. Previously we were only setting that once the form element was edited.tab
to focus an element, then press space to pick it up. Move it up and down with the arrow keys and press space to drop.x
because the cancel button removes the element.My next PR will remove the order column from form_elements, and add the same dragging/reranking functionality to the pub_values inputs on form fill pages
Test Plan