App icon indicating copy to clipboard operation
App copied to clipboard

[HOLD for payment 2022-07-15] [$250] Emoji Search Bar focus indicator is missing - reported by Santhoshkumar Sellavel

Open mvtglobally opened this issue 4 years ago β€’ 26 comments

If you haven’t already, check out our contributing guidelines for onboarding and email [email protected] to request to join our Slack channel!


Action Performed:

  1. Open new Expensify in web/desktop
  2. Open any chat
  3. Click on the emoji icon in the composer
  4. Enter the search input

Expected Result:

Search input has a focus indicator, like other search inputs

Actual Result:

Search input has no focus indicator.

Workaround:

unknown

Platform:

Where is this issue occurring?

  • Web
  • Desktop App

Version Number: 1.1.76-0 Reproducible in staging?: Y Reproducible in production?: Y Email or phone of affected tester (no customers): Logs: https://stackoverflow.com/c/expensify/questions/4856 Notes/Photos/Videos: Any additional supporting documentation

Expensify/Expensify Issue URL:

https://user-images.githubusercontent.com/43995119/173277564-4481b44d-a694-4d6a-9c04-93a79d2531d6.mov

Issue reported by: @Santhosh-Sellavel Slack conversation: https://expensify.slack.com/archives/C01GTK53T8Q/p1653082016688519

View all open jobs on GitHub

mvtglobally avatar Jun 13 '22 04:06 mvtglobally

Triggered auto assignment to @MitchExpensify (AutoAssignerTriage), see https://stackoverflow.com/c/expensify/questions/4749 for more details.

melvin-bot[bot] avatar Jun 13 '22 04:06 melvin-bot[bot]

Proposal

We can make a state isFocused and we can make it true at onFocus and false at onBlur

https://github.com/Expensify/App/blob/6bac9af7294877114f8bf9532ff7b8c46146c90d/src/components/EmojiPicker/EmojiPickerMenu/index.js#L437-L442 we need to use it like this:

onFocus={() => this.setState({isFocused: true})}
onBlur={() => this.setState({isFocused: false})}

now we have to use isFocused to change border color. We can do that by using the below line at composer

 style={[styles.textInput, this.state.isFocused && styles.borderColorFocus]}

Puneet-here avatar Jun 13 '22 10:06 Puneet-here

Proposal

we should use TextInput instead of Composer as Composer is intended to compose messages and should not be used in this place. https://github.com/Expensify/App/blob/6bac9af7294877114f8bf9532ff7b8c46146c90d/src/components/EmojiPicker/EmojiPickerMenu/index.js#L437-L442

we should do

<TextInput 
textAlignVertical="top" 
placeholder={this.props.translate('common.search')} 
placeholderTextColor={themeColors.textSupporting} 
onChangeText={this.filterEmojis} 
style={styles.textInput}

Doing this would solve the issue but will alter the height of the input field slightly, but it would be the same as all the other input fields so I think this would not be a problem but, it could be changed if necessary.

Harshdeepjoshi avatar Jun 13 '22 12:06 Harshdeepjoshi

This would be consistent but I'm not sure it adds much value, do you think this change is worth it in the name of consistency @michelle-thompson ?

MitchExpensify avatar Jun 14 '22 16:06 MitchExpensify

Hmm, not sure what would be best here so adding Engineering label here!

michelle-thompson avatar Jun 14 '22 18:06 michelle-thompson

Hmm, not sure what would be best here so adding Engineering label here!

michelle-thompson avatar Jun 14 '22 18:06 michelle-thompson

Triggered auto assignment to @TomatoToaster (Engineering), see https://stackoverflow.com/c/expensify/questions/4319 for more details.

melvin-bot[bot] avatar Jun 14 '22 18:06 melvin-bot[bot]

I think it's worth fixing this - it's definitely a small visual change but it feels like it would look better. I'm not on the management team so I'll let an engineer from there review the proposals and confirm this is worth it.

TomatoToaster avatar Jun 16 '22 18:06 TomatoToaster

Triggered auto assignment to @Christinadobrzyn (External), see https://stackoverflow.com/c/expensify/questions/8582 for more details.

melvin-bot[bot] avatar Jun 16 '22 18:06 melvin-bot[bot]

Created job in Upwork

Internal - https://www.upwork.com/ab/applicants/1537544134022590464/job-details External - https://www.upwork.com/jobs/~01d76621dc2b371865

Christinadobrzyn avatar Jun 16 '22 21:06 Christinadobrzyn

Triggered auto assignment to Contributor-plus team member for initial proposal review - @Santhosh-Sellavel (Exported)

melvin-bot[bot] avatar Jun 16 '22 21:06 melvin-bot[bot]

Triggered auto assignment to @Luke9389 (Exported), see https://stackoverflow.com/c/expensify/questions/7972 for more details.

melvin-bot[bot] avatar Jun 16 '22 21:06 melvin-bot[bot]

Open for new proposals.

Santhosh-Sellavel avatar Jun 17 '22 16:06 Santhosh-Sellavel

@Santhosh-Sellavel Please share your reviews on this proposal.

Harshdeepjoshi avatar Jun 18 '22 10:06 Harshdeepjoshi

Proposal

Problem

The Composer is not having the styles.borderColorFocus assigned to it.

Solution

  • Add highlightComposer: false, to the state to keep track of whether the Composer is focused or not.
  • Add onFocus and onBlur event handler to the composer to update the highlightComposer state variable.
  • Set the style on the Composer based on the highlightComposer state variable.

Code changes:

this.state = {
    filteredEmojis: this.emojis,
    headerIndices: this.unfilteredHeaderIndices,
    highlightedIndex: -1,
    arePointerEventsDisabled: false,
    highlightComposer: false,
    selection: {
        start: 0,
        end: 0,
    },
};
<Composer
    textAlignVertical="top"
    placeholder={this.props.translate('common.search')}
    placeholderTextColor={themeColors.textSupporting}
    onChangeText={this.filterEmojis}
    onFocus={() => this.setState({highlightComposer: true})}
    onBlur={() => this.setState({highlightComposer: false})}
    style={[styles.textInput, this.state.highlightComposer && styles.borderColorFocus]}
    defaultValue=""
    ref={el => this.searchInput = el}
    autoFocus
    selectTextOnFocus={this.state.selectTextOnFocus}
    onSelectionChange={this.onSelectionChange}
/>

Screencast:

https://user-images.githubusercontent.com/911879/174441545-108720a9-b5cf-4866-a065-c9f85a9af0be.mp4

liyamahendra avatar Jun 18 '22 13:06 liyamahendra

@Santhosh-Sellavel, can you review my proposal ?

Puneet-here avatar Jun 18 '22 17:06 Puneet-here

@liyamahendra's proposal is just restating @Puneet-here's from above. Also @Santhosh-Sellavel can you give a written explanation (even just a short one) when you πŸ‘Ž proposals, please? Contributors need to know why their work is not accepted in order to improve.

Luke9389 avatar Jun 20 '22 16:06 Luke9389

On @Harshdeepjoshi proposal,

Doing this would solve the issue but will alter the height of the input field slightly.

Not on board with changing the component itself as it might cause unexpected regressions. So gave πŸ‘Ž

Sorry, somehow I missed @Puneet-here's comment! @liyamahendra's Proposal is the same as Puneet's.

So I like @Puneet-here Proposal here. Looks good to me! πŸŽ€ πŸ‘€ πŸŽ€ C+ reviewed

cc: @Luke9389

Santhosh-Sellavel avatar Jun 20 '22 17:06 Santhosh-Sellavel

OK cool, go ahead ands start a PR @Puneet-here!

Luke9389 avatar Jun 20 '22 18:06 Luke9389

Now that this is assigned I'm going to bump it down to weekly.

Luke9389 avatar Jun 21 '22 17:06 Luke9389