Skip to content

Conversation

carylwyatt
Copy link
Member

@carylwyatt carylwyatt commented Sep 30, 2025

The problem

Our wordpress theme has "contact us" buttons sprinkled throughout our pages, and these buttons are supposed to open the feedback form modal, but after the svelte 5 migration, these stopped working.

Why this was happening

I missed that there was a separate component instantiation step happening for elements with the data attribute data-hathi-trigger. These components were still being created as classes, but in svelte 5, components are functions.

a11y

While testing that this fix worked, I noticed that the keyboard navigation flow wasn't correct. Closing the feedback modal put the focus in the navbar on the "GET HELP" dropdown item. We added this conditional/DOM manipulation during the deque audit, but I failed to remember that the feedback modal isn't always triggered from the navbar.

I added a new variable/prop for modals, focusButtonOnClose that is applied to the "basic" feedback form if the form prop is set to contact. Since I had to create a new version of the form for that variable, I took the opportunity to change the title of only this version of the feedback form modal from "Questions?" to "Contact HathiTrust."

I also had the opportunity to fix a long-standing a11y issue: the IDs in the FeedbackFormBasic form were not actually unique. Because we sometimes have two (or three in the case of the contact page) of these forms on the page at the same time, an ID of "email" is not unique enough. I changed the ID variable to use the new $props.id() rune, which creates a unique identifier for each instance of a component, then added that variable to each form label/input.

wordpress theme

There's a corresponding PR over in hathitrust/wordpress-hathitrust#50 for the updated markup that uses the data-hathi-trigger element.

See it in action

This is up on dev-3 at https://dev-3.www.hathitrust.org/contact/

let slug = el.dataset.hathiTrigger;
let props = buildProps(el);
el.component = new apps[slug]({
el.component = mount(apps[slug], {
Copy link
Member Author

Choose a reason for hiding this comment

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

The culprit!

@carylwyatt carylwyatt force-pushed the ETT-586-wp-feedback-modal branch 2 times, most recently from 2d17bd3 to 836a41f Compare October 1, 2025 13:46
@carylwyatt carylwyatt force-pushed the ETT-586-wp-feedback-modal branch from 836a41f to 492ae98 Compare October 1, 2025 15:59
@carylwyatt carylwyatt requested a review from Ronster2018 October 1, 2025 20:15
Copy link

@Ronster2018 Ronster2018 left a comment

Choose a reason for hiding this comment

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

Aftrer navigating around with the keyboard and opening/closing the feedback modal, the focus goes back to the "Ask me anything" button.

@carylwyatt
Copy link
Member Author

Aftrer navigating around with the keyboard and opening/closing the feedback modal, the focus goes back to the "Ask me anything" button.

@Ronster2018 That is the expected/correct behavior, thank you for confirming! Any other questions for me or is this ready to go?

@carylwyatt carylwyatt merged commit 2a24115 into main Oct 6, 2025
5 checks passed
@carylwyatt carylwyatt deleted the ETT-586-wp-feedback-modal branch October 6, 2025 18:21
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.

2 participants