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

[RNMobile] Add mobile Spacer component #17896

Merged
merged 23 commits into from
Nov 1, 2019
Merged

[RNMobile] Add mobile Spacer component #17896

merged 23 commits into from
Nov 1, 2019

Conversation

lukewalczak
Copy link
Member

@lukewalczak lukewalczak commented Oct 11, 2019

Description

Ref to gb-mobile: wordpress-mobile/gutenberg-mobile#1436
Fixes: wordpress-mobile/gutenberg-mobile#1428

NOTE: That PR requires RangeControl mobile component -> #17282 to control spacer height using slider.

That PR adds a mobile Spacer component.

UPDATES:

  • Implemented Accessibility - double press on Cell is focusing the Slider once screen reader is enabled

  • Corrected dark more check the screenshot

  • Typing a value works properly check the gif

  • Styling changes according to @iamthomasbishop comment:

    • outline border-width is set to 2px
    • outline border color is set to blue-30
    • dashed border color is dimmed (30%)
    • added padding-bottom to cell (16px)
    • added done button

iOS: Screenshot one and two
Android: Screenshot one and two.

  • Fix focusing slider when VO is ON on iPhoneX

  • Add an information for VO about current value when changing value

How has this been tested?

  • Choose Spacer component.
  • Press settings button
  • Play with a spacer height using slider:
    • default value: 100
    • minValue: 20
    • maxValue: 500 NOTE: if user sets height 800 on the website and then edits it on the phone, the value from web can be in the middle of the range, so user can decrease and increase the value as well.
  • Save post on mobile
  • Open the same post on the web
  • Play with the height, e.g. set it to 1000 and save a post
  • Open the same post again on mobile and check the Spacer height

Screenshots

android ios
spacer_android spacer_ios
  • setting a spacer height on web

spacer_4

  • setting a spacer height on mobile

spacer_5

NOTE: On the gifs there is a wrong label Slider instead of Height in pixels which is correct in the code.

Types of changes

Checklist:

  • My code is tested.
  • My code follows the WordPress code style.
  • My code follows the accessibility standards.
  • My code has proper inline documentation.
  • I've included developer documentation if appropriate.

@lukewalczak
Copy link
Member Author

lukewalczak commented Oct 24, 2019

@koke I've extracted logic to RangeCell as you requested. I'm still wondering what will be an advantage of moving TextInput into RangeCell instead having it inside a Slider. Could you please elaborate on that?

EDIT: Maybe we don't need a Slider component itself (as a separate component)? - we can have a Slider along with TextInput inside RangeCell. Is that what you meant? - I've refactored it actually in that way, let me know wdyt.

Also after the refactor I was not able to reproduce that 'jiggly' behaviour.

@iamthomasbishop
Copy link

@lukewalczak Looks nice in the updated screenshots, thanks for wrangling those changes!

dashed border color is dimmed (30%)

Just want to confirm, this is only on dark mode, correct?

added padding-bottom to cell (16px)

This looks better, but can we remove the trailing separator on the last table row?

added done button

This is great! Does this also get an Android equivalent?

Two more things, neither of which are blockers:

  • If it's not a hassle, can we make the Done text label blue 30 as well?
  • Regarding the Slider component in general, can we force the Slider/TextInput "group" to a second line in the same table row? This is a bit narrow.

@koke
Copy link
Contributor

koke commented Oct 24, 2019

EDIT: Maybe we don't need a Slider component itself (as a separate component)? - we can have a Slider along with TextInput inside RangeCell. Is that what you meant? - I've refactored it actually in that way, let me know wdyt.

That looks like what I had in mind, but for some reason I thought the Slider part had some more custom behavior than adding the input.

@lukewalczak
Copy link
Member Author

lukewalczak commented Oct 24, 2019

@koke Do you think we can accept the structure as it is right now?

@lukewalczak
Copy link
Member Author

lukewalczak commented Oct 24, 2019

@iamthomasbishop I've updated PR description and added Android screenshots 🎉

Just want to confirm, this is only on dark mode, correct?

Correct ✅

This looks better, but can we remove the trailing separator on the last table row?

Sure!

Regarding the Slider component in general, can we force the Slider/TextInput "group" to a second line in the same table row? This is a bit narrow

Generally, that issue will be fix within styling issue, but honestly I'm all for doing it within in this PR. Just let me know if you are ok with that ✌️.

@iamthomasbishop
Copy link

Generally, that issue will be fix within styling issue, but honestly I'm all for doing it within in this PR. Just let me know if you are ok with that ✌️.

@lukewalczak Ah ok, either way is fine by me although the sooner the better 😄

Copy link
Contributor

@etoledom etoledom left a comment

Choose a reason for hiding this comment

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

Thank you for the improvements @lukewalczak !

I gave it a try with VoiceOver on device (iPhone X), and double-tapping on the cell didn't focus the slider. Did a bit of debugging and I noticed that onCellPress is not being called.
It is called when I tap on it normally, but it won't with VoiceOver.

About: #17896 (comment)

What I wanted to achieve here is to make the parent component (Cell) not accessible, since I want to focus Slider and have also TextInput accessible as well.

That sounds good! It's the approach we follow on other blocks too 👍

Wdyt about having there only one component when screen reader is enabled?

Could you please expand a bit? Do you mean having only slider?
If that's the case, wouldn't auto-focusing the slider be enough and simpler?

Both platforms are reading the slider value in percents, e.g. 100 px is is read as 17 percents.

True that, and it's probably not a good thing in this case. Since 10% can mean different thing on different situations, and in this case, there's no visual help for the user. I think it's best if we can let them know the precise height amount.

A good example is the Music app. It has the the Volume scroller that says its value on percent, and there's the track position scroller. Since songs has different lengths, it won't make much sense to say percents there, so they say the current time together with the total time of the song while dragging it.

If this is blocking other work, I'm happy to ✅ as it is and improve these details separately.

Everything else looks great to me! 🎉
Thank you again!

@lukewalczak
Copy link
Member Author

lukewalczak commented Oct 28, 2019

@etoledom Thanks for feedback! I was testing accessibility on iPhone 7, so will dive into the issue on iPhoneX.

A good example is the Music app. It has the the Volume scroller that says its value on percent, and there's the track position scroller. Since songs has different lengths, it won't make much sense to say percents there, so they say the current time together with the total time of the song while dragging it.

I'm not sure what can I do in that matter. Probably I can inform user about current value when user releases the finger / changing a value, however voice over will also pass the info in percents.

@lukewalczak
Copy link
Member Author

@etoledom Could you please re-test it? 🙏

Copy link
Contributor

@etoledom etoledom left a comment

Choose a reason for hiding this comment

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

Accessibility on iOS is working better now. Thanks @lukewalczak for the update!

I added a small code comment, but overall looks good to me 🎉
Great job 🙏

@pinarol pinarol merged commit f73ebe6 into master Nov 1, 2019
daniloercoli added a commit that referenced this pull request Nov 5, 2019
…rnmobile/gb-mobile-872-JSApplicationIllegalArgumentException-in-RCTAztecView

* 'master' of https://github.com/WordPress/gutenberg: (56 commits)
  Update: Default gradients. (#18214)
  Fix: setting a preset color on pullquote default style makes the block invalid (#18194)
  Fix default featured image size (#15844)
  Fix postmeta radio regression. (#18183)
  Components: Switch screen-reader-text to VisuallyHidden (#18165)
  [rnmobile] Release 1.16.0 to master (#18261)
  Template Loader: Add theme block template resolution. (#18247)
  Add a README file for storybook directory (#18245)
  Add editor-gradient-presets to get_theme_support (#17841)
  Add "Image Title Attribute" as an editable attribute on the image block (#11070)
  enables horizontal movers in social blocks (#18234)
  [RNMobile] Add mobile Spacer component (#17896)
  Add experimental `ResponsiveBlockControl` component (#16790)
  Fix mover for floats. (#18230)
  Rename Component to WPComponent in docstring (#18226)
  Colors Selector: replace `Aa` text by SVG icon (#18222)
  Removed gif from README (#18200)
  makes the submenu items stacked vertically (#18221)
  Add block navigator to sidebar panel for nav block (#18202)
  Fix: consecutive updates may trigger a blocks reset (#18219)
  ...
@etoledom etoledom deleted the rnmobile/spacer branch November 6, 2019 16:05
@youknowriad youknowriad added this to the Gutenberg 6.9 milestone Nov 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Mobile App - i.e. Android or iOS Native mobile impl of the block editor. (Note: used in scripts, ping mobile folks to change)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add Spacer block - 1st iteration
7 participants