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

Prevent slider and image drag i-beam cursor on safari #14381

Merged
merged 3 commits into from Jan 18, 2023

Conversation

jatinsonijs
Copy link
Contributor

Details

Cursor Pointer changes to I-beam while dragging image or slider knob in edit photo. Prevented this default behaviour by disable selection on slider and image cropper elements.

Fixed Issues

$ #13688
PROPOSAL: #13688 (comment)

Tests

  1. Open Settings page.
  2. Click on User avatar -> Camera icon -> Upload photo.
  3. Choose photo.
  4. Try to drag slider and image.
  5. Make sure cursor not changing to I-Beam (specially on safari).
  • Verify that no errors appear in the JS console

Offline tests

  1. Open Settings page.
  2. Click on User avatar -> Camera icon -> Upload photo.
  3. Choose photo.
  4. Try to drag slider and image.
  5. Make sure cursor not changing to I-Beam (specially on safari).

QA Steps

  1. Open Settings page.
  2. Click on User avatar -> Camera icon -> Upload photo.
  3. Choose photo.
  4. Try to drag slider and image.
  5. Make sure cursor not changing to I-Beam (specially on safari).
  • Verify that no errors appear in the JS console

PR Author Checklist

  • I linked the correct issue in the ### Fixed Issues section above
  • I wrote clear testing steps that cover the changes made in this PR
    • I added steps for local testing in the Tests section
    • I added steps for the expected offline behavior in the Offline steps section
    • I added steps for Staging and/or Production testing in the QA steps section
    • I added steps to cover failure scenarios (i.e. verify an input displays the correct error message if the entered data is not correct)
    • I turned off my network connection and tested it while offline to ensure it matches the expected behavior (i.e. verify the default avatar icon is displayed if app is offline)
    • I tested this PR with a High Traffic account against the staging or production API to ensure there are no regressions (e.g. long loading states that impact usability).
  • I included screenshots or videos for tests on all platforms
  • I ran the tests on all platforms & verified they passed on:
    • Android / native
    • Android / Chrome
    • iOS / native
    • iOS / Safari
    • MacOS / Chrome / Safari
    • MacOS / Desktop
  • I verified there are no console errors (if there's a console error not related to the PR, report it or open an issue for it to be fixed)
  • I followed proper code patterns (see Reviewing the code)
    • I verified that any callback methods that were added or modified are named for what the method does and never what callback they handle (i.e. toggleReport and not onIconClick)
    • I verified that comments were added to code that is not self explanatory
    • I verified that any new or modified comments were clear, correct English, and explained "why" the code was doing something instead of only explaining "what" the code was doing.
    • I verified any copy / text shown in the product is localized by adding it to src/languages/* files and using the translation method
      • If any non-english text was added/modified, I verified the translation was requested/reviewed in #expensify-open-source and it was approved by an internal Expensify engineer. Link to Slack message:
    • I verified all numbers, amounts, dates and phone numbers shown in the product are using the localization methods
    • I verified any copy / text that was added to the app is correct English and approved by marketing by adding the Waiting for Copy label for a copy review on the original GH to get the correct copy.
    • I verified proper file naming conventions were followed for any new files or renamed files. All non-platform specific files are named after what they export and are not named "index.js". All platform-specific files are named for the platform the code supports as outlined in the README.
    • I verified the JSDocs style guidelines (in STYLE.md) were followed
  • If a new code pattern is added I verified it was agreed to be used by multiple Expensify engineers
  • I followed the guidelines as stated in the Review Guidelines
  • I tested other components that can be impacted by my changes (i.e. if the PR modifies a shared library or component like Avatar, I verified the components using Avatar are working as expected)
  • I verified all code is DRY (the PR doesn't include any logic written more than once, with the exception of tests)
  • I verified any variables that can be defined as constants (ie. in CONST.js or at the top of the file that uses the constant) are defined as such
  • I verified that if a function's arguments changed that all usages have also been updated correctly
  • If a new component is created I verified that:
    • A similar component doesn't exist in the codebase
    • All props are defined accurately and each prop has a /** comment above it */
    • The file is named correctly
    • The component has a clear name that is non-ambiguous and the purpose of the component can be inferred from the name alone
    • The only data being stored in the state is data necessary for rendering and nothing else
    • For Class Components, any internal methods passed to components event handlers are bound to this properly so there are no scoping issues (i.e. for onClick={this.submit} the method this.submit should be bound to this in the constructor)
    • Any internal methods bound to this are necessary to be bound (i.e. avoid this.submit = this.submit.bind(this); if this.submit is never passed to a component event handler like onClick)
    • All JSX used for rendering exists in the render method
    • The component has the minimum amount of code necessary for its purpose, and it is broken down into smaller components in order to separate concerns and functions
  • If any new file was added I verified that:
    • The file has a description of what it does and/or why is needed at the top of the file if the code is not self explanatory
  • If a new CSS style is added I verified that:
    • A similar style doesn't already exist
    • The style can't be created with an existing StyleUtils function (i.e. StyleUtils.getBackgroundAndBorderStyle(themeColors.componentBG)
  • If the PR modifies a generic component, I tested and verified that those changes do not break usages of that component in the rest of the App (i.e. if a shared library or component like Avatar is modified, I verified that Avatar is working as expected in all cases)
  • If the PR modifies a component related to any of the existing Storybook stories, I tested and verified all stories for that component are still working as expected.
  • If a new page is added, I verified it's using the ScrollView component to make it scrollable when more elements are added to the page.
  • I have checked off every checkbox in the PR author checklist, including those that don't apply to this PR.

Screenshots/Videos

Web
web-safari.mp4
Mobile Web - Chrome
mweb-android.mov
Mobile Web - Safari
mweb-ios.mov
Desktop
desktop.mp4
iOS
mobile-ios.mp4
Android
mobile-android.mov

@jatinsonijs jatinsonijs requested a review from a team as a code owner January 18, 2023 04:48
@melvin-bot melvin-bot bot requested review from aimane-chnaif and puneetlath and removed request for a team January 18, 2023 04:48
@melvin-bot
Copy link

melvin-bot bot commented Jan 18, 2023

@puneetlath @aimane-chnaif One of you needs to copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button]

@aimane-chnaif
Copy link
Contributor

While testing, I noticed inconsistent behavior between safari and other browsers when drag after selecting text.

Safari (production):

safari-production.mov

Safari (after fix):

safari-fix.mov

Chrome (production):

chrome-production.mov

Chrome (after fix):

chrome-fix.mov

So in some cases text is deselected and in some cases, text keeps selected.
(✅: keep selected, ❌: deselected)

Platform Codebase Image Move Slider Knob Slider Range
Safari Production
Safari Local
Chrome Production
Chrome Local
Firefox Production
Firefox Local
mChrome Production
mChrome Local
mSafari Production
mSafari Local

This is minor issue and not actually affects app features. I am not sure this should be handled here.
As long as browsers are inconsistent in production, I think we can safely ignore this.
@puneetlath what do you think?

@jatinsonijs
Copy link
Contributor Author

jatinsonijs commented Jan 18, 2023

@aimane-chnaif I have tested it just now, first one is same at my side in both production and local.

@aimane-chnaif
Copy link
Contributor

@aimane-chnaif I have tested it just now, first one is same at my side in both production and local.

@jatinsonijs which one exactly? can you test all browsers and comment with chart like I did?

@jatinsonijs
Copy link
Contributor Author

@aimane-chnaif other are same are you added
only first one is different for me

Platform Codebase Image Move Slider Knob Slider Range
Safari Production
Safari Local
Chrome Production
Chrome Local
Firefox Production
Firefox Local
mChrome Production
mChrome Local
mSafari Production
mSafari Local

@jatinsonijs
Copy link
Contributor Author

@aimane-chnaif I think we can leave it as it is bcz there is no use case here text selection + drag.

@aimane-chnaif
Copy link
Contributor

@aimane-chnaif I think we can leave it as it is bcz there is no use case here text selection + drag.

yup, other than that, looks good and tests well.
Let's wait for 🟢 from @puneetlath

@puneetlath
Copy link
Contributor

Hmm, that's interesting. Great job with thorough testing.

I think I agree with you both that this doesn't matter. There are no expectations around whether text should stay selected or not after selecting and then interacting with another element, so I think it's fine. No user will have any expectations or think this is a bug.

@aimane-chnaif
Copy link
Contributor

Reviewer Checklist

  • I have verified the author checklist is complete (all boxes are checked off).
  • I verified the correct issue is linked in the ### Fixed Issues section above
  • I verified testing steps are clear and they cover the changes made in this PR
    • I verified the steps for local testing are in the Tests section
    • I verified the steps for Staging and/or Production testing are in the QA steps section
    • I verified the steps cover any possible failure scenarios (i.e. verify an input displays the correct error message if the entered data is not correct)
    • I turned off my network connection and tested it while offline to ensure it matches the expected behavior (i.e. verify the default avatar icon is displayed if app is offline)
  • I checked that screenshots or videos are included for tests on all platforms
  • I included screenshots or videos for tests on all platforms
  • I verified tests pass on all platforms & I tested again on:
    • Android / native
    • Android / Chrome
    • iOS / native
    • iOS / Safari
    • MacOS / Chrome / Safari
    • MacOS / Desktop
  • If there are any errors in the console that are unrelated to this PR, I either fixed them (preferred) or linked to where I reported them in Slack
  • I verified proper code patterns were followed (see Reviewing the code)
    • I verified that any callback methods that were added or modified are named for what the method does and never what callback they handle (i.e. toggleReport and not onIconClick).
    • I verified that comments were added to code that is not self explanatory
    • I verified that any new or modified comments were clear, correct English, and explained "why" the code was doing something instead of only explaining "what" the code was doing.
    • I verified any copy / text shown in the product is localized by adding it to src/languages/* files and using the translation method
    • I verified all numbers, amounts, dates and phone numbers shown in the product are using the localization methods
    • I verified any copy / text that was added to the app is correct English and approved by marketing by adding the Waiting for Copy label for a copy review on the original GH to get the correct copy.
    • I verified proper file naming conventions were followed for any new files or renamed files. All non-platform specific files are named after what they export and are not named "index.js". All platform-specific files are named for the platform the code supports as outlined in the README.
    • I verified the JSDocs style guidelines (in STYLE.md) were followed
  • If a new code pattern is added I verified it was agreed to be used by multiple Expensify engineers
  • I verified that this PR follows the guidelines as stated in the Review Guidelines
  • I verified other components that can be impacted by these changes have been tested, and I retested again (i.e. if the PR modifies a shared library or component like Avatar, I verified the components using Avatar have been tested & I retested again)
  • I verified all code is DRY (the PR doesn't include any logic written more than once, with the exception of tests)
  • I verified any variables that can be defined as constants (ie. in CONST.js or at the top of the file that uses the constant) are defined as such
  • If a new component is created I verified that:
    • A similar component doesn't exist in the codebase
    • All props are defined accurately and each prop has a /** comment above it */
    • The file is named correctly
    • The component has a clear name that is non-ambiguous and the purpose of the component can be inferred from the name alone
    • The only data being stored in the state is data necessary for rendering and nothing else
    • For Class Components, any internal methods passed to components event handlers are bound to this properly so there are no scoping issues (i.e. for onClick={this.submit} the method this.submit should be bound to this in the constructor)
    • Any internal methods bound to this are necessary to be bound (i.e. avoid this.submit = this.submit.bind(this); if this.submit is never passed to a component event handler like onClick)
    • All JSX used for rendering exists in the render method
    • The component has the minimum amount of code necessary for its purpose, and it is broken down into smaller components in order to separate concerns and functions
  • If any new file was added I verified that:
    • The file has a description of what it does and/or why is needed at the top of the file if the code is not self explanatory
  • If a new CSS style is added I verified that:
    • A similar style doesn't already exist
    • The style can't be created with an existing StyleUtils function (i.e. StyleUtils.getBackgroundAndBorderStyle(themeColors.componentBG)
  • If the PR modifies a generic component, I tested and verified that those changes do not break usages of that component in the rest of the App (i.e. if a shared library or component like Avatar is modified, I verified that Avatar is working as expected in all cases)
  • If the PR modifies a component related to any of the existing Storybook stories, I tested and verified all stories for that component are still working as expected.
  • If a new page is added, I verified it's using the ScrollView component to make it scrollable when more elements are added to the page.
  • I have checked off every checkbox in the PR reviewer checklist, including those that don't apply to this PR.

Screenshots/Videos

Web
web-chrome.mov
web-safari.mov
Mobile Web - Chrome
mchrome.mov
Mobile Web - Safari
msafari.mp4
Desktop
desktop.mov
iOS
ios.mp4
Android
android.mov

@puneetlath puneetlath merged commit 5370c36 into Expensify:main Jan 18, 2023
@OSBotify
Copy link
Contributor

✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release.

@github-actions
Copy link
Contributor

Performance Comparison Report 📊

Significant Changes To Duration

There are no entries

Meaningless Changes To Duration

Show entries
Name Duration
Open Search Page TTI 602.620 ms → 615.155 ms (+12.535 ms, +2.1%)
App start TTI 691.129 ms → 699.764 ms (+8.635 ms, +1.2%)
App start regularAppStart 0.015 ms → 0.015 ms (-0.000 ms, -1.6%)
App start nativeLaunch 21.031 ms → 20.250 ms (-0.781 ms, -3.7%)
App start runJsBundle 192.781 ms → 187.844 ms (-4.938 ms, -2.6%)
Show details
Name Duration
Open Search Page TTI Baseline
Mean: 602.620 ms
Stdev: 17.439 ms (2.9%)
Runs: 571.3916830001399 577.2991539998911 577.7461350001395 578.4433190000709 579.3251960000489 586.4155680001713 589.355916999979 589.3662930000573 589.3903000000864 589.5318199999165 592.1319170000497 592.9597579999827 595.0091959999409 595.4573570000939 596.871541999979 597.9167080000043 601.0421549999155 604.9242350000422 605.9191900000442 606.232788000023 609.0107429998461 609.5437419998925 611.4591880000662 614.3340669998433 615.2684730000328 616.1833909999114 617.4030349999666 621.5541189999785 626.2169599998742 627.8642170000821 631.0294190000277 634.4200440000277 635.4305829999503

Current
Mean: 615.155 ms
Stdev: 28.775 ms (4.7%)
Runs: 571.5609540003352 577.4215090000071 577.591023999732 580.7273759995587 581.8324790000916 584.0893560000695 588.328980000224 590.5879310001619 591.6474199998192 594.3097330001183 594.3991290000267 601.3234870000742 603.7438560002483 604.4748129998334 605.9455979997292 607.6284999996424 608.0419919998385 609.7270510001108 610.4930830001831 611.3876139996573 624.3833820000291 624.9457200001925 625.8957119998522 633.9048259998672 638.7126059997827 643.5027270000428 647.4685060000047 652.5039059999399 656.750855000224 656.7648529997095 662.48384599993 668.6760249999352 668.846923999954
App start TTI Baseline
Mean: 691.129 ms
Stdev: 35.708 ms (5.2%)
Runs: 627.8421700000763 635.9491570000537 637.6572430001106 647.7343699999619 653.6595119999256 655.5116920000874 659.2064930000342 659.5338359999005 661.4981559999287 669.3558090000879 669.7254490000196 678.558197000064 679.2693789999466 680.6398809999228 685.1514409999363 685.2960739999544 687.3309740000404 687.9530899999663 696.8117829998955 698.6732550000306 702.9012939999811 713.8997919999529 716.3179049999453 718.8588980000932 721.0207509999163 724.2808060001116 725.0744710001163 735.410666000098 735.8497500000522 740.8086590000894 752.441773999948 771.9062959998846

Current
Mean: 699.764 ms
Stdev: 31.175 ms (4.5%)
Runs: 643.8538959999569 647.4917069999501 650.5442240000702 661.5836649998091 668.3614219999872 670.7605179999955 674.7042610000353 676.8904510000721 683.2010949999094 685.8831819999032 686.2785110000987 686.7518489998765 687.6164239998907 689.9165370000992 692.7867149999365 694.7721059999894 695.0499629999977 704.0339959999546 705.2677930002101 706.4352599999402 709.4373230000492 711.191426999867 713.8437709999271 714.3658270000014 720.3735120000783 722.2018230000976 726.511369000189 729.9266369999386 746.954696000088 752.8412170000374 761.6416180001106 770.9613590000663
App start regularAppStart Baseline
Mean: 0.015 ms
Stdev: 0.001 ms (5.7%)
Runs: 0.013835000107064843 0.014200999867171049 0.014444999862462282 0.014485999941825867 0.014526000013574958 0.014689000090584159 0.014850999927148223 0.014851000159978867 0.014932999853044748 0.014932999853044748 0.014973999932408333 0.01525900000706315 0.015299999853596091 0.015339999925345182 0.015339999925345182 0.015381000004708767 0.015503000002354383 0.01558400015346706 0.015746999997645617 0.015786999836564064 0.015910000074654818 0.01611399999819696 0.016195000149309635 0.0163569999858737 0.01647999999113381 0.01688600005581975 0.01688600005581975 0.017089999979361892 0.01721199997700751

Current
Mean: 0.015 ms
Stdev: 0.001 ms (5.7%)
Runs: 0.013956000097095966 0.013956000097095966 0.013996999943628907 0.01411899970844388 0.014118999941274524 0.014201000100001693 0.014362999936565757 0.014404000015929341 0.01460699993185699 0.014607000164687634 0.014608000172302127 0.014730000169947743 0.015015000011771917 0.01509599993005395 0.015177000081166625 0.015217999927699566 0.015217999927699566 0.015421000076457858 0.015463000163435936 0.015503000002354383 0.015583999920636415 0.015625 0.015625 0.01570700015872717 0.015909999841824174 0.015910000074654818 0.016193999908864498 0.016193999908864498 0.016275999834761024 0.01680499967187643 0.0168869998306036 0.017008999828249216
App start nativeLaunch Baseline
Mean: 21.031 ms
Stdev: 3.264 ms (15.5%)
Runs: 17 18 18 18 18 18 18 18 19 19 19 19 19 19 20 20 20 20 21 21 21 21 21 23 24 24 24 25 26 28 28 29

Current
Mean: 20.250 ms
Stdev: 2.236 ms (11.0%)
Runs: 17 18 18 18 18 18 18 19 19 19 19 19 19 19 19 19 20 20 20 20 20 21 21 21 22 22 23 24 24 24 24 26
App start runJsBundle Baseline
Mean: 192.781 ms
Stdev: 23.089 ms (12.0%)
Runs: 165 165 166 167 170 174 178 178 179 179 180 180 181 182 183 184 185 185 186 188 194 195 205 205 209 210 212 222 226 242 245 249

Current
Mean: 187.844 ms
Stdev: 16.039 ms (8.5%)
Runs: 163 164 168 172 173 176 176 176 178 178 179 180 182 182 183 183 183 184 185 185 186 188 190 195 202 206 212 215 215 217 217 218

@OSBotify
Copy link
Contributor

🚀 Deployed to staging by https://github.com/puneetlath in version: 1.2.57-0 🚀

platform result
🤖 android 🤖 success ✅
🖥 desktop 🖥 success ✅
🍎 iOS 🍎 success ✅
🕸 web 🕸 success ✅

@OSBotify
Copy link
Contributor

🚀 Deployed to production by https://github.com/luacmartins in version: 1.2.57-3 🚀

platform result
🤖 android 🤖 failure ❌
🖥 desktop 🖥 success ✅
🍎 iOS 🍎 success ✅
🕸 web 🕸 success ✅

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.

None yet

4 participants