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

[$500] Web -Split bill- Square appears over checkmark when deselect participant and than use keyboard arrow #32400

Closed
1 of 6 tasks
kbecciv opened this issue Dec 2, 2023 · 72 comments
Assignees
Labels
Bug Something is broken. Auto assigns a BugZero manager. Engineering Internal Requires API changes or must be handled by Expensify staff Reviewing Has a PR in review Weekly KSv2

Comments

@kbecciv
Copy link

kbecciv commented Dec 2, 2023

If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!


Version Number: 1.4.7-0
Reproducible in staging?: y
Reproducible in production?: y
If this was caught during regression testing, add the test name, ID and link from TestRail:
Email or phone of affected tester (no customers):
Logs: https://stackoverflow.com/c/expensify/questions/4856
Expensify/Expensify Issue URL:
Issue reported by: Applause - Internal Team
Slack conversation:

Action Performed:

  1. Navigate to http://staging.new.expensify.com/
  2. Open Group DM
  3. Click on "+" near message composer
  4. Click on "Split bill"
  5. Insert amount
  6. Click "Next"
  7. Click with mouse on any member to deselect it
  8. Use the keyboard up/down arrows to go through the list

Expected Result:

There should be no visual errors while scrolling through members list

Actual Result:

White square appears over checkmark when deselect participant and than use keyboard arrow

Workaround:

Unknown

Platforms:

Which of our officially supported platforms is this issue occurring on?

  • Android: Native
  • Android: mWeb Chrome
  • iOS: Native
  • iOS: mWeb Safari
  • MacOS: Chrome / Safari
  • MacOS: Desktop

Screenshots/Videos

Add any screenshot/video evidence

Bug6298629_1701521884927.Recording__1447.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~017a562fd6464d4101
  • Upwork Job ID: 1730966804029255680
  • Last Price Increase: 2023-12-23
@kbecciv kbecciv added External Added to denote the issue can be worked on by a contributor Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Dec 2, 2023
@melvin-bot melvin-bot bot changed the title Web -Split bill- Square appears over checkmark when deselect participant and than use keyboard arrow [$500] Web -Split bill- Square appears over checkmark when deselect participant and than use keyboard arrow Dec 2, 2023
Copy link

melvin-bot bot commented Dec 2, 2023

Job added to Upwork: https://www.upwork.com/jobs/~017a562fd6464d4101

Copy link

melvin-bot bot commented Dec 2, 2023

Triggered auto assignment to @dylanexpensify (Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details.

@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label Dec 2, 2023
Copy link

melvin-bot bot commented Dec 2, 2023

Bug0 Triage Checklist (Main S/O)

  • This "bug" occurs on a supported platform (ensure Platforms in OP are ✅)
  • This bug is not a duplicate report (check E/App issues and #expensify-bugs)
    • If it is, comment with a link to the original report, close the issue and add any novel details to the original issue instead
  • This bug is reproducible using the reproduction steps in the OP. S/O
    • If the reproduction steps are clear and you're unable to reproduce the bug, check with the reporter and QA first, then close the issue.
    • If the reproduction steps aren't clear and you determine the correct steps, please update the OP.
  • This issue is filled out as thoroughly and clearly as possible
    • Pay special attention to the title, results, platforms where the bug occurs, and if the bug happens on staging/production.
  • I have reviewed and subscribed to the linked Slack conversation to ensure Slack/Github stay in sync

Copy link

melvin-bot bot commented Dec 2, 2023

Triggered auto assignment to Contributor-plus team member for initial proposal review - @eVoloshchak (External)

@tienifr
Copy link
Contributor

tienifr commented Dec 2, 2023

Proposal

Please re-state the problem that we are trying to solve in this issue.

Square appears over checkmark when deselect participant and press arrow key

What is the root cause of that problem?

A div's tabIndex is set with 0 by default.

What changes do you think we should make in order to solve the problem?

Set tabIndex to -1 of the View wrapping circle icon:

<View style={[styles.selectCircle, styles.alignSelfCenter, selectCircleStyles]}>

However, the circle border is still focusable:

Screenshot 2023-12-02 at 22 57 33

In case we want to completely forbid focusing by key on Icon, we can set tabIndex={-1} to the Views inside Icon component here and here. Or we can introduce tabIndex prop for Icon so we can manually control the focus behavior here.

What alternative solutions did you explore? (Optional)

NA

@bernhardoj
Copy link
Contributor

bernhardoj commented Dec 2, 2023

Proposal

Please re-state the problem that we are trying to solve in this issue.

The check(circle) icon of money request confirmation list outline is squared instead of circle.

What is the root cause of that problem?

The money request confirmation list currently uses OptionsSelector which renders OptionRow as the item. In OptionRow, we render the check(circle) with a Pressable and SelectCircle component.

<PressableWithFeedback
onPress={() => props.onSelectedStatePressed(props.option)}
disabled={isDisabled}
role={CONST.ACCESSIBILITY_ROLE.CHECKBOX}
accessibilityLabel={CONST.ACCESSIBILITY_ROLE.CHECKBOX}
>
<SelectCircle isChecked={props.isSelected} />
</PressableWithFeedback>

SelectCircle is the one that renders the circle and the checked icon. The pressable itself doesn't have any style, so when we focus it with keyboard, we see a squared outline. Also, if we look carefully, the outline has an extra space on the left that is caused by a margin-left (styles.selectCircle) that is applied in SelectCircle.

image

<View style={[styles.selectCircle, styles.alignSelfCenter, selectCircleStyles]}>
{isChecked && (
<Icon
src={Expensicons.Checkmark}
fill={theme.iconSuccessFill}
/>
)}
</View>

What changes do you think we should make in order to solve the problem?

First, we need to set the SelectCircle margin-left to 0,

<SelectCircle isChecked={props.isSelected} selectCircleStyles={styles.ml0} />

and move it to the pressable. Next, apply the same border-radius + 1 (padding) style of SelectCircle to the pressable similar to what we did in Checkbox,

style={[StyleUtils.getCheckboxPressableStyle(containerBorderRadius + 2), style]} // to align outline on focus, border-radius of pressable should be 2px more than Checkbox

and also add padding 1 so the blue outline is visible (similar to Checkbox where we add 2 padding).

<PressableWithFeedback
    style={{borderRadius: (variables.componentSizeSmall / 2) + 1, padding: 1, ...styles.ml2}}

if we don't add the padding, the blue outline won't show because it's covered by the outline of SelectCircle

@tanmai-kms
Copy link

Proposal

Please re-state the problem that we are trying to solve in this issue.

The square appears over checkmark when deselecting participant not only uses keyboard arrow but also clicks on checkbox directly

What is the root cause of that problem?

The root cause is that it's impacted from global style :focus-visible

:focus-visible {

What changes do you think we should make in order to solve the problem?

We shouldn't fix it inside SelectCircle component only because the issue is happening with all Pressable -> GenericPressable components

We should add new 1 more global style for [data-tag="pressable"]:focus-visible with box-shadow: none in the web/index.html. This is to make all "pressable" component correct.

What alternative solutions did you explore? (Optional)

We can fix by adding new style for Pressable component

Copy link

melvin-bot bot commented Dec 2, 2023

📣 @tanmai-kms! 📣
Hey, it seems we don’t have your contributor details yet! You'll only have to do this once, and this is how we'll hire you on Upwork.
Please follow these steps:

  1. Make sure you've read and understood the contributing guidelines.
  2. Get the email address used to login to your Expensify account. If you don't already have an Expensify account, create one here. If you have multiple accounts (e.g. one for testing), please use your main account email.
  3. Get the link to your Upwork profile. It's necessary because we only pay via Upwork. You can access it by logging in, and then clicking on your name. It'll look like this. If you don't already have an account, sign up for one here.
  4. Copy the format below and paste it in a comment on this issue. Replace the placeholder text with your actual details.
    Screen Shot 2022-11-16 at 4 42 54 PM
    Format:
Contributor details
Your Expensify account email: <REPLACE EMAIL HERE>
Upwork Profile Link: <REPLACE LINK HERE>

@tanmai-kms
Copy link

Contributor details
Your Expensify account email: duytan.learning.agu@gmail.com
Upwork Profile Link: https://www.upwork.com/freelancers/~01b376159894de44f5

Copy link

melvin-bot bot commented Dec 2, 2023

✅ Contributor details stored successfully. Thank you for contributing to Expensify!

@suneox
Copy link
Contributor

suneox commented Dec 2, 2023

Proposal

Please re-state the problem that we are trying to solve in this issue.

Web -Split bill- Square appears over checkmark when deselect participant and than use keyboard arrow

What is the root cause of that problem?

By default, we have config focus-visible to set box-shadow when lose focus

What changes do you think we should make in order to solve the problem?

For this case OptionRow has handled up/down key to select an item so on PressableWithFeedback at this line we just add style styles.noSelect and remove accessibility when use tab instead of up/down key

    <PressableWithFeedback
        onPress={() => props.onSelectedStatePressed(props.option)}
        disabled={isDisabled}
        role={CONST.ACCESSIBILITY_ROLE.CHECKBOX}
        accessibilityLabel={CONST.ACCESSIBILITY_ROLE.CHECKBOX}
+       style={styles.noSelect}
+       tabIndex={-1}
    >
        <SelectCircle isChecked={props.isSelected} />
    </PressableWithFeedback>

What alternative solutions did you explore? (Optional)

@melvin-bot melvin-bot bot added the Overdue label Dec 5, 2023
@dylanexpensify
Copy link
Contributor

@eVoloshchak to review proposals!

@melvin-bot melvin-bot bot removed the Overdue label Dec 5, 2023
@dragnoir
Copy link
Contributor

dragnoir commented Dec 7, 2023

Proposal

Please re-state the problem that we are trying to solve in this issue.

Web -Split bill- Focus from browser appears over checkmark and over the row when deselect participant or select roo, than use keyboard arrow up/down

What is the root cause of that problem?

The issue is bigger than just a focus style applied to a selected HTML element.
When we click on a row, in the dom it's a button or a div with aria-label="checkbox", the browser apply a focus on it, wish next can trigger actions by the keyboard.

004.mp4

If we follow this flow:
1- With mouse, click on the last element under "split with" (not the checkbox), the row
2- move to the upper row with keyboard (now the previous row is focused but the new row have the beackground effect wish visually seems it's the one focused)
3- from keyboard, push "space", and here appear the true bug, the action happen on the previous row, wish is wrong.
⇒ This happen because browser is keeping focus on the element we interacted with mouse
The <ArrowKeyFocusManager> change the state of foocusedIndex buit does not manupulate or mutate the space or change the focus on the browser.

Even if we execute the previous proposals, changing focus style on index html to to box-shadow: none; or outline:0;, or adding the tabIndex={-1} , the main issue I described will persist, just the visual focus effect will diseppear.

What changes do you think we should make in order to solve the problem?

Once we click on a PressableWithFeedback we need to use the blur() method. This HTMLElement.blur() method removes keyboard focus from the clicked element.

<PressableWithFeedback
ref={(el) => (pressableRef.current = el)}
onPress={(e) => {

We can apply it on onPress

<PressableWithFeedback
	ref={(el) => (pressableRef.current = el)}
	onPress={(e) => {
	// ....

	pressableRef.current.blur();

}}

We need also to apply the same blur method to the checkbox and this solve boath issues.

<PressableWithFeedback
onPress={() => props.onSelectedStatePressed(props.option)}

change to:

<PressableWithFeedback
	ref={pressableRowRef}
	onPress={() => {
		props.onSelectedStatePressed(props.option);
		pressableRowRef.current.blur();
	}}

Result (video)

005.mp4

@melvin-bot melvin-bot bot added the Overdue label Dec 8, 2023
Copy link

melvin-bot bot commented Dec 9, 2023

📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸

@dylanexpensify
Copy link
Contributor

@eVoloshchak to review proposals!

@melvin-bot melvin-bot bot removed the Overdue label Dec 11, 2023
@dylanexpensify
Copy link
Contributor

Bump @eVoloshchak

@eVoloshchak
Copy link
Contributor

The issue turned out to be more complex, we have 3 distinct problems with the participants list

  1. Blue outline appears over the checkmark when selecting participant and then using a keyboard arrow
  2. Select a participant using arrow keys, press "Space" to add a participant. Notice the wrong participant is selected (@dragnoir has described this problem in their proposal)
  3. Whether you can select a user by pressing "Space" is not consistent. It's possible only if you click on the list of participants (which defeats the purpose of keyboard navigation), and if you click outside the list, it stops working
Screen.Recording.2023-12-13.at.23.14.39.mov

A proposal to resolve all of the issues above would be ideal, we'd fix the whole keyboard navigation flow on this page

@bernhardoj
Copy link
Contributor

Keyboard navigation should be out of the scope of this issue. The issue here is simply about the focus outline of the circle.

There is an issue here that is trying to fix the inconsistent keyboard navigation (looking at the PR, they will prioritize the row that has the browser focus).

Whether you can select a user by pressing "Space" is not consistent. It's possible only if you click on the list of participants (which defeats the purpose of keyboard navigation), and if you click outside the list, it stops working

You can only select by pressing Space when the element is focused. This is the native behavior of the web. Currently, we only have a custom enter listener. Having a new custom space key listener would be a new feature.

Copy link

melvin-bot bot commented Dec 16, 2023

@eVoloshchak @dylanexpensify this issue was created 2 weeks ago. Are we close to approving a proposal? If not, what's blocking us from getting this issue assigned? Don't hesitate to create a thread in #expensify-open-source to align faster in real time. Thanks!

@bernhardoj
Copy link
Contributor

PR is ready

cc: @shubham1206agra

@dragnoir
Copy link
Contributor

@shubham1206agra the PR submitted still have the issue I mentioned.

I think my proposal is better, it remove the issue.

@dragnoir solution works in this case but will have a problem with keyboard selection and we can still see misaligned blue box if we try to go with keyboard (tab/shift+tab).

Also about keyboard keyboard (tab/shift+tab), pls check here https://expensify.slack.com/archives/C01GTK53T8Q/p1668604822482759 we are not supporting this type of navigation I guess

@dylanexpensify
Copy link
Contributor

@bernhardoj @shubham1206agra what's holding up our merge?

@shubham1206agra
Copy link
Contributor

@dylanexpensify I am OOO right now. Will review the PR tomorrow.

@shubham1206agra
Copy link
Contributor

@shubham1206agra the PR submitted still have the issue I mentioned.

I think my proposal is better, it remove the issue.

Sorry but your changes will fall under keyboard navigation changes, which is not allowed. The proposal by @bernhardoj will fix the visual inconsistencies, and will also fix the area of pressable action of checkbox.

@dragnoir solution works in this case but will have a problem with keyboard selection and we can still see misaligned blue box if we try to go with keyboard (tab/shift+tab).

Also about keyboard keyboard (tab/shift+tab), pls check here https://expensify.slack.com/archives/C01GTK53T8Q/p1668604822482759 we are not supporting this type of navigation I guess

About support, I have asked the same internally https://expensify.slack.com/archives/C02NK2DQWUX/p1706050548700389?thread_ts=1705396204.297479&cid=C02NK2DQWUX

@dragnoir
Copy link
Contributor

@shubham1206agra thank you for your reply.

Please test the PR when you have time, if you do this:

  • Select or deselect an option with mouse
  • navigate with arrow key top or down
  • click on space or enter

then the wrong option will be actioned (selected/deselected) not the one highlighted.

@shubham1206agra
Copy link
Contributor

@shubham1206agra thank you for your reply.

Please test the PR when you have time, if you do this:

* Select or deselect an option with mouse

* navigate with arrow key top or down

* click on space or enter

then the wrong option will be actioned (selected/deselected) not the one highlighted.

Highlighted by what?
I think there are 2 different highlighting occurring at the same time, which is causing these problems. I will open up a discussion for the same later.

@dylanexpensify
Copy link
Contributor

@bernhardoj @shubham1206agra can we get an update please

@shubham1206agra
Copy link
Contributor

shubham1206agra commented Feb 7, 2024

PR is merged already, and is deployed to prod too.

@dragnoir
Copy link
Contributor

dragnoir commented Feb 9, 2024

@shubham1206agra as I mentioned before, the issue is not fixed, the silution implemented I think it's just a workaround.

Please check the video demonstrationg the issue after the PR.

20240209_105351.mp4

Currently just the focus style is changed from square to round. But when you navigate and try to select an element from the list, the action happen the the previous element where the focus is not where the new element selected

@dylanexpensify As you see from the video and the screenshot below, when I navigate to (2) and I click on space or enter on the keyboard, the item that should be selected/deselected is (2) not (1) as happening now.

image

@shubham1206agra
Copy link
Contributor

@dragnoir I understand what you are saying, but I am saying that this issue requires changes to keyboard navigation structure. So, the issue is out of scope of the current issue. You may want to open another issue for this issue for a detailed discussion for this.

@dragnoir
Copy link
Contributor

dragnoir commented Feb 9, 2024

@shubham1206agra we already support this type of navigation in other component like search, LHN, .... also keeping the focus actif on an item, for the user, means the ability to interact with it with keyboard or with other navigation tools. I think just changing the style to round and don't care about what element is trully focused it very bad UX and not a fix for such an app.

@dylanexpensify
Copy link
Contributor

@shubham1206agra mind confirming where we're at

@shubham1206agra
Copy link
Contributor

@dylanexpensify The PR was deployed a week ago. So we can get ready for payment.

@shubham1206agra
Copy link
Contributor

For #32400 (comment), we need to open another issue to start the discussion about Keyboard Nav.

cc @dylanexpensify

@dylanexpensify
Copy link
Contributor

Got it - will do today!

@shubham1206agra
Copy link
Contributor

@dylanexpensify Can you start payment here?

@dylanexpensify
Copy link
Contributor

Yes!

Payment summary:

Please request/apply!

@shubham1206agra
Copy link
Contributor

@dylanexpensify You need to send us an offer.

@dylanexpensify
Copy link
Contributor

I know - in the works!

@dylanexpensify
Copy link
Contributor

Offers sent!

@dylanexpensify
Copy link
Contributor

done!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something is broken. Auto assigns a BugZero manager. Engineering Internal Requires API changes or must be handled by Expensify staff Reviewing Has a PR in review Weekly KSv2
Projects
None yet
Development

No branches or pull requests

10 participants