-
Notifications
You must be signed in to change notification settings - Fork 352
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
[Numeric Input] - Show "Format Options" Tooltip as List #1861
base: main
Are you sure you want to change the base?
Conversation
npm Snapshot: PublishedGood news!! We've packaged up the latest commit from this PR (5ae985c) and published it to npm. You Example: yarn add @khanacademy/perseus@PR1861 If you are working in Khan Academy's webapp, you can run: ./dev/tools/bump_perseus_version.sh -t PR1861 |
Size Change: +150 B (+0.01%) Total Size: 1.29 MB
ℹ️ View Unchanged
|
Update snapshots to account for new tooltip layout.
GeraldRequired Reviewers
Don't want to be involved in this pull request? Comment |
|
||
// Assert | ||
expect(renderer).toHaveBeenAnsweredIncorrectly(); | ||
}); |
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.
This isn't new. I just re-organized the tests to group them better. If the first test was "accept correct answer", I would think the next test would be "reject an incorrect answer". This also enabled me to group the snapshot tests together.
@@ -541,24 +541,20 @@ | |||
} | |||
} | |||
|
|||
// TODO(joel) - remove? | |||
.perseus-tooltip { |
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.
This style wasn't really used, other than to be a base later on in .perseus-formats-tooltip
. So, I just moved this styling to where it is used.
padding: 5px 10px; | ||
width: 240px; | ||
} | ||
|
||
// CSS is evil; let's overwrite some styles. T_T |
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.
No! CSS is not evil. Misunderstood, maybe. But definitely not evil.
margin: -20px 0 -16px 0; | ||
> li { | ||
list-style-type: none; | ||
} |
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.
There's no evidence that this was ever needed. A list should (almost) always look like a list.
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.
Nice!
.map((example, index) => { | ||
// If the first example is bold, then it is most likely a heading/leading text. | ||
// So, it shouldn't be part of the list. | ||
return index === 0 && example.startsWith("**") |
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.
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.
That's the plan. We have follow-up tickets to refactor aspects of Numeric Input. Seeing as how InputWithExamples
isn't used anywhere else, we are considering bringing this component into Numeric Input and simplifying the two code bases.
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.
Seems straightforward - Thanks for all the cleanup work with the CSS!
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 pretty good. Just curious about the data-perseus attribute.
</div> | ||
<div | ||
class="paragraph" | ||
data-perseus-paragraph-index="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.
What is this data-perseus-paragraph-index
attribute? Is it like our version of tabIndex
?
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.
Question has been posted to the team.
Summary:
Upon receiving focus, the Numeric Input field will show a tooltip indicating the format of the answer that it is expecting (assuming the input was configured with suggested formats). When multiple formats are indicated, they should be displayed as a list. Currently, the formats are indeed HTML list elements, but they don't display as list items (all formatting has been removed). This change fixes the visual formatting to display the items as a list, but only if there are two or more items. In the case of just one format example, the HTML list element is removed, and the content is displayed as regular text. Also, the first line in the tooltip is more of an introductory text than a format option, and therefore should not be included in the HTML list markup.
Issue: LEMS-2457
Test plan:
NOTE: Only the HTML modifications can be testing locally (aka Storybook). The visual modifications must be verified in a ZND (or locally in Webapp containerized) because the styling that interferes with the list styling does not exist in Storybook.
Storybook:
Webapp (locally or in a ZND):