Skip to content

Conversation

@jrjohnson
Copy link
Member

The purpose was to fix ilios/ilios#6532, but I needed to take the entire thing apart so we could remove links only when needed. Took advantage of contextual component, some things we've learned about modifiers, and a new css feature mask-image to remove a lot of duplication.

Best reviewed as individual commits.

@netlify
Copy link

netlify bot commented Oct 1, 2025

Deploy Preview for ilios-frontend ready!

Name Link
🔨 Latest commit 254a291
🔍 Latest deploy log https://app.netlify.com/projects/ilios-frontend/deploys/68fb08b266491f00083292cd
😎 Deploy Preview https://deploy-preview-8858--ilios-frontend.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@jrjohnson jrjohnson marked this pull request as ready for review October 1, 2025 22:00
@jrjohnson jrjohnson removed the request for review from stopfstedt October 1, 2025 22:24
@stopfstedt
Copy link
Member

stopfstedt commented Oct 3, 2025

i believe there's a cleaner and simpler solution to the accessibility issue that this is addressing, which builds on most of these changes.

please see jrjohnson#896 and #8858.

Copy link
Member

@stopfstedt stopfstedt left a comment

Choose a reason for hiding this comment

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

LGTM

@dartajax dartajax added the run ui tests Run the expensive UI tests label Oct 17, 2025
@dartajax dartajax assigned jrjohnson and unassigned dartajax Oct 17, 2025
@stopfstedt stopfstedt self-requested a review October 21, 2025 20:55
Copy link
Member

@stopfstedt stopfstedt left a comment

Choose a reason for hiding this comment

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

needs a minor fix in the test coverage, otherwise good.


assert.false(this.expanded, 'text is not expanded');
assert.dom('.display-text-wrapper', this.element).hasClass(this.fadedClass);
assert.ok(component.enabled);
Copy link
Member

Choose a reason for hiding this comment

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

needs to await fadedSelector to be present.

Suggested change
assert.ok(component.enabled);
await waitFor(this.fadedSelector);
assert.ok(component.enabled);

import { module, test } from 'qunit';
import { setupRenderingTest } from 'test-app/tests/helpers';
import { render, waitFor } from '@ember/test-helpers';
import { render } from '@ember/test-helpers';
Copy link
Member

Choose a reason for hiding this comment

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

waitFor is still needed.

Suggested change
import { render } from '@ember/test-helpers';
import { render, waitFor } from '@ember/test-helpers';

Instead of passing options to the component and adding a handler to the
container we can use a local modifier to handle the save  and close
keyboard interactions and pass that back to consumers of EditableField.
This makes the API easier to understand as not applying the modifier
will prevent any keyboard handing and allows us to remove an invalid
interactive issue.
Using named blocks to extract some of the HTML handling from here and
remove a few branches. Also removed the unused @showIcon option.

WIP commit as more work will need to be done because now there is a text expand button
inside the field editing button.
Using contextual components we can curry the values we need for
controlling text fading and use them where we apply this component. I
also found a way using css mask-image to fade out the text with the
component itself instead of needing to do that everywhere we use it.

These things combined let us wrap the EditableField inside the fade text
so we get the editable behavior, but maintain the expand collapse
buttons outside of the editable button.

Taken all together we can remove a lot of duplicate code and rely solely
on the FadeText component to do this work without needing to duplicate
the HTML and styles elsewhere.
This has a tendency to fall out of date (as it did with removing froala
and keeping this class here). Instead we can use the modifier directly
on the controls as they won't appear in the DOM until they're ready.
This takes away some magic and simplifies the component.
When editable field is passed things that look empty it is impossible to
click and edit them. I've slightly changed the original behavior and
used the icon only if the click prompt isn't passed.
We only use this in one place, but it's nice to have.
Automatically remove links from text, but allow them to be preserved if
needed. Can be invoked on the FadeText component or on the yielded
contextual component as needed.

Mostly we're removing them, but I kept links in when in a read only
display of the faded text.
The resizeObserver fires asynchronously in browser code so tests may run
before it has a chance to detect the size and send it. This can cause
intermittent test failures. I've added a test waiter to FadeText to
ensure that we've gotten at least one call to register the size of the
element before we test anything.
@jrjohnson jrjohnson removed the run ui tests Run the expensive UI tests label Oct 23, 2025
Doing this in the constructor doesn't work because the FadeText is often
created with the FadedText hidden.
Doing a lot of test waiter setup and work isn't worth it here. My
concern that the non faded text tests were not accurate because they
hadn't had a chance to fully render probably isn't worth the extra
overhead. Going back to the waitFor check to get these two tests to
pass.
@jrjohnson jrjohnson added the run ui tests Run the expensive UI tests label Oct 24, 2025
@jrjohnson
Copy link
Member Author

Adding some thoughts for posterity about the waitFor vs test waiter approach. I ended up going with this last commit and restoring the waitFor because it is far simpler and works fine, but I'm worried about the other FadeText tests where text is not faded/ This test is not definitive because we know that sometimes, even with long text, the initial size won't be reflected when the test runs (that's why we have a waitFor) so in that case the test would pass, even if the result, after a short delay, would have been a failure.

@stopfstedt stopfstedt dismissed their stale review October 28, 2025 15:00

stale review.

@stopfstedt stopfstedt self-requested a review October 28, 2025 15:00
@stopfstedt stopfstedt merged commit 8693a83 into ilios:master Oct 28, 2025
38 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

run ui tests Run the expensive UI tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Accessibility of Editable Fields with Links

3 participants