Skip to content
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

fix automatic scrolling with htmx requests #990

Merged
merged 15 commits into from
Feb 27, 2024
Merged

Conversation

caseyhans
Copy link
Collaborator

@caseyhans caseyhans commented Feb 9, 2024

Fixes the automatic scrolling on the workflows list page while CRUDing, and adds an animation for smoothness.
Previously, updating or creating a workflow would snap focus to the name input field of the first form present on the page (which creates a bug if multiple forms are present). After cancelling or saving the form, users would be left looking at the page footer, since the form is so long and the save/cancel buttons are at the bottom. This PR saves the scroll position before a form is brought onto the page and then reinstates that scroll position once form operations are complete.

  • List is now always ordered by creation time, descending (newest first)
  • Create form moved to top of the list
  • Fixes script placement for help text popups

Copy link
Owner

@shapiromatron shapiromatron left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes look good, but I think we should refactor the code to put most of this into the HAWCUtils.js file so we can reuse in other HTMX places. The same will be true on the epiv2 and eco forms, and TBH, they're used a lot more than the workflow edit forms, so we should move the goodness over there too.

hawc/apps/lit/templates/lit/workflows.html Outdated Show resolved Hide resolved
@shapiromatron shapiromatron changed the title fix automatic scrolling on workflows page fix automatic scrolling with htmx requests Feb 12, 2024
@shapiromatron shapiromatron self-assigned this Feb 23, 2024
@shapiromatron
Copy link
Owner

@caseyhans is this one ready for re-review?

Copy link
Owner

@shapiromatron shapiromatron left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM - I did mostly some minor code formatting changes:

  • ab436f6 delete row (3 minutes ago)
  • 8dbdf75 update naming and a few minor logic changes (8 minutes ago)
  • b0d46b7 rename to better reflect what it does (58 minutes ago)
  • 9961645 rename addScrollHTMX to addScrollHtmx (4 hours ago)
  • 4edbd84 rename delRow to deleteRow (4 hours ago)

@caseyhans
Copy link
Collaborator Author

@shapiromatron had to add back delete for workflow edit rows, or the create button scroll doesn't work after the first time

@caseyhans caseyhans merged commit 323428e into main Feb 27, 2024
3 checks passed
@caseyhans caseyhans deleted the workflow-scroll-animations branch February 27, 2024 22:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants