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

[QUO-325] Clean up blank underline block #1595

Merged
merged 7 commits into from
Jan 17, 2024

Conversation

lindsaykwardell
Copy link
Contributor

@lindsaykwardell lindsaykwardell commented Jan 12, 2024

Change some minor styles based on feedback from Stacey.

🔧 Modifying a component

Context

https://github.com/NoRedInk/NoRedInk/pull/46846#issuecomment-1883598283

🖼️ What does this change look like?

image

Component completion checklist

  • I've gone through the relevant sections of the Development Accessibility guide with the changes I made to this component in mind
  • Changes are clearly documented
    • Component docs include a changelog
    • Any new exposed functions or properties have docs
  • Changes extend to the Component Catalog
    • The Component Catalog is updated to use the newest version, if appropriate
    • The Component Catalog example version number is updated, if appropriate
    • Any new customizations are available from the Component Catalog
    • The component example still has:
      • an accurate preview
      • valid sample code
      • correct keyboard behavior
      • correct and comprehensive guidance around how to use the component
  • Changes to the component are tested/the new version of the component is tested
  • Component API follows standard patterns in noredink-ui
    • e.g., as a dev, I can conveniently add an nriDescription
    • and adding a new feature to the component will not require major API changes to the component
  • If this is a new major version of the component, our team has stories created to upgrade all instances of the old component. Here are links to the stories:
    • add your story links here OR just write this is not a new major version
  • Please assign the following reviewers (applicable Sep 2023–Dec 2023):
    • a11y-volunteer-reviewers - Someone from this group will review your PR in full.
    • team-accessibilibats-a11ybats - Someone from this group will review your PR for ACCESSIBILITY ONLY.
    • Someone from your team who can review requirements from your team's perspective. (This could be the same person from the a11y-volunteer-reviewers group if you'd like.)
    • If there are user-facing changes, a designer. (You may want to direct your designer to the deploy preview for easy review):
      • For writing-related component changes, add Stacey (staceyadams)
      • For quiz engine-related components, add Ravi (ravi-morbia)
      • For a11y-related changes to general components, add Ben (bendansby)
      • For general component-related changes or if you’re not sure about something, add the Design group (NoRedInk/design)

@lindsaykwardell lindsaykwardell changed the title Cleam up blank underline block Clean up blank underline block Jan 12, 2024
@lindsaykwardell lindsaykwardell requested review from staceyadams, a team, juanedi, ArthurJordao, tesk9 and mfonism and removed request for a team January 12, 2024 23:07
Underline ->
[ Css.textDecoration Css.underline
, Css.property "text-decoration-thickness" "1px"
, Css.property "text-underline-offset" "4.5px"
Copy link
Contributor

Choose a reason for hiding this comment

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

Perhaps 0.2rem or something like that instead? so that this style works well for 30px fonts and 18px fonts.

4.5px looks a bit far to me for an 18px font:

Screenshot 2024-01-12 at 6 39 04 PM

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The main issue I was running into was getting it aligned with a blank underline, which is why I was moving it at all. Happy to go toward a different solution, I wasn't attached or happy with how this was turning out.

Copy link
Contributor

Choose a reason for hiding this comment

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

Okay! I think I'm following. So border-bottom is used for adding a "blank" underline and text-decoration is used for adding underlines to actual text?

I think this brings me back to my question from yesterday: "Should non-blanks ever be underlined?" Like, is the intention of the underline just to be a different styling for a blank? If so, then I don't think we'd ever need text-decoration at all? (Although I think an API change could clarify the expected behavior a bit.)

Copy link
Member

@staceyadams staceyadams Jan 16, 2024

Choose a reason for hiding this comment

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

Like, is the intention of the underline just to be a different styling for a blank?

Yes. In our context, students thought the dashed bordered rectangle versions of the blanks meant that it was interactive (they're not)

Copy link
Contributor Author

@lindsaykwardell lindsaykwardell Jan 16, 2024

Choose a reason for hiding this comment

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

How about this?

30px 18px
image image

Instead of adjusting the border offset for the text, I adjusted the line height of the blank, bringing it up rather than down. I also set the border/underline to 0.1rem, which at a default zoom is rendering at 1.5px.

Copy link
Member

Choose a reason for hiding this comment

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

Oops, missed the first part of Tessa's question. We don't underline text in Short Response. I'm not 💯 sure but don't think there's a use case for it in scaffolding or Guided Tutorials either? (the other 2 places currently using Block)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I was just aiming for some consistency between the two modes. Taking away the names the component is currently using, we have two display modes that we want to be able to choose between:

  • Show blanks with dashes
  • Show blanks with underlines

Originally, I felt it made more sense to make that a global thing: show everything with dashes, or show everything as underlined. If we are feeling this is not the case, I can scope that down to just blanks.

Copy link
Contributor

Choose a reason for hiding this comment

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

Personally, I think we should not show everything as underlines. The case that really clinches it for me is a blank within an emphasis, which is the one you've got screenshots of up above in this thread:

image

I would expect the "underline" style to look like this:
image

Not like this:

image

Copy link
Member

Choose a reason for hiding this comment

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

Ah, I get where the other underlines came from. We want to apply underline to just blanks. Or apply to everything, but have the border go all the way around except in blanks, where it should just be on the bottom.

We don't currently have a use case to change the dashes on the other Block elements. The border is there for added contrast in addition to the background color.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fine with me! Here's the update (which looks just like Tessa's example):

image

@@ -542,7 +542,7 @@ toMark config { backgroundColor, borderColor } =
Underline ->
Css.solid

notBottomBorderColor =
borderColor_ =
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we definitely want to use a different color for the underline than the text?

image

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No, we definitely want the text color to apply to the underline. I was not finding a solution that felt good for that, because I wasn't finding where the text color is set inside the component. I was assuming it came from outside.

Copy link
Contributor

Choose a reason for hiding this comment

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

Ahh I see! This is happening because of the user agent stylesheet.

In the screenshot above, there's a label, so the blank is treated as highlighted by "fruit." Semantically, we're using the mark tag for this:
image

If there's no label or emphasis, the styles apply as expected:
image

(I don't have an opinion on whether this is worth addressing as part of this PR, but if you do override the user agent stylesheet, please check that high contrast mode keeps working.)

config.labelCss
++ (case ( config.borderStyle, config.content ) of
( Underline, [ Blank _ ] ) ->
[ Css.top (Css.px 6)
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think adjusting the top px will work consistently for a couple of reasons.

The first reason is variable font size. As far as I am aware, the Block component is used in containers that set the font to 30px and in containers that set the font to 18px. I believe the place the underline is going to be used has 18px font.

30px 18px 12px
Original Spacing image image image
New Spacing image image image

Users should be able to customize their font size without all our styles breaking. But even if we don't set that as a goal, I'm not sure that the 6px from the top will land in the right spot, you know?

The second reason I think we should change approaches here is that setting the top to 6px will sometimes play badly with repositioning:

previous behavior top: 6px
image image
Code for the above screenshots

On #1594 or with it merged in, adjust the first repositioning example to use:

, Block.view
                    [ Block.plaintext "gifts"
                    , Block.label "direct object collision"
                    , Block.yellow
                    , Block.labelId directObjectId
                    , Block.labelPosition (Dict.get directObjectId offsets)
                    ]
                , Block.view [ Block.plaintext " " ]
                , Block.view
                    [ Block.label "long adjectives shouldn't hit a lil"
                    , Block.underline
                    , Block.purple
                    , Block.labelId adjectiveId
                    , Block.labelPosition (Dict.get adjectiveId offsets)
                    ]

A third reason is that when labels aren't repositioned, the 6px change will make them look a little funky when they're rendered next to normal labels:

image

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Member

@staceyadams staceyadams Jan 16, 2024

Choose a reason for hiding this comment

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

@lindsaykwardell let's revert this part.

@tesk9 for context of why we wanted to change this: the labels look more detached in the use in Short Response because we use the blank in 3 sentences in a column, sometimes with label, sometimes without. In the third sentence frame example, you can see that it appears equidistant between the second and third bullet so not immediately visually clear at a glance that it belongs to the third one.

image

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Reverted this change.

@tesk9
Copy link
Contributor

tesk9 commented Jan 16, 2024

Looks good! @lindsaykwardell would you please review/merge #1594 so that the changes are a little easier to double check?

@lindsaykwardell
Copy link
Contributor Author

Done!

Copy link
Contributor

@tesk9 tesk9 left a comment

Choose a reason for hiding this comment

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

Looks great! Thanks!

Someone may want to update the corresponding Paper document still (although I'm not sure who owns that work at this point! Not me, I'm pretty sure 😆)

@tesk9
Copy link
Contributor

tesk9 commented Jan 16, 2024

I thought I'd double-check high-contrast mode, and just FYI the experience is a little confusing when the blank appears within an emphasis. If we're planning to use the new underline blank styles with emphasis, this is something we might want to improve.

Standard contrast High contrast
Blank Screenshot 2024-01-16 at 3 40 08 PM Screenshot 2024-01-16 at 3 37 55 PM
Blank in emphasis Screenshot 2024-01-16 at 3 40 02 PM Screenshot 2024-01-16 at 3 37 36 PM
Mixed content Screenshot 2024-01-16 at 3 40 15 PM Screenshot 2024-01-16 at 3 38 11 PM

@lindsaykwardell
Copy link
Contributor Author

I just pushed up a change to support the correct background in high contrast mode, although I'm not 100% certain how to enable it locally to test.

@tesk9
Copy link
Contributor

tesk9 commented Jan 17, 2024

I just pushed up a change to support the correct background in high contrast mode

Yay, thank you!!

I'm not 100% certain how to enable it locally to test.

We have an instructional guide for testing in high contrast mode! 🎉

@staceyadams
Copy link
Member

I can own updating the Paper doc

@lindsaykwardell lindsaykwardell merged commit 7db3f8e into master Jan 17, 2024
8 checks passed
@lindsaykwardell lindsaykwardell deleted the quokka/clean-up-underline-block branch January 17, 2024 21:16
@lindsaykwardell lindsaykwardell changed the title Clean up blank underline block [QUO-325] Clean up blank underline block Jan 17, 2024
Copy link

linear bot commented Jan 17, 2024

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.

3 participants