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

[ Latest Posts ] Max. number of words control doesn't react to keyboard input #21549

Closed
bph opened this issue Apr 11, 2020 · 5 comments · Fixed by #22084
Closed

[ Latest Posts ] Max. number of words control doesn't react to keyboard input #21549

bph opened this issue Apr 11, 2020 · 5 comments · Fixed by #22084
Assignees
Labels
[Block] Latest Posts Affects the Latest Posts Block [Status] In Progress Tracking issues with work in progress [Type] Bug An existing feature does not function as intended

Comments

@bph
Copy link
Contributor

bph commented Apr 11, 2020

Describe the bug
The default value for excerpt display is 55 words. There are three methods available, it seems, to modify that number in the sidebar

  1. Slider
  2. up/down 1
  3. Type in a new value.

The third method, typing in a new value, doesn't work.

To reproduce
Steps to reproduce the behavior:

  1. Insert Latest Posts block
  2. Open the Block settings sidebar
  3. Enable Post Content
  4. Check Excerpt
  5. Try modify the number of words displayed with the keyboard

Expected behavior
I would have expected that I would be able to modify the number by typing in the right value.

Screenshots
Screen Shot 2020-04-11 at 5 03 43 PM

Desktop (please complete the following information):

  • OS: [e.g. iOS] 10.15.3
  • Browser [e.g. chrome, safari] Chrome
  • Version [e.g. 22] 80.0.3987.163

Additional context
Gutenberg 7.8.1
WordPress 5.4

@draganescu draganescu added [Block] Latest Posts Affects the Latest Posts Block [Type] Bug An existing feature does not function as intended labels Apr 13, 2020
@draganescu
Copy link
Contributor

I tested this and can confirm this is a bug.

@draganescu draganescu changed the title Latest Posts: Max. number of words control don't react to keyboard input [ Latest Posts ] Max. number of words control don't react to keyboard input Apr 13, 2020
@bph bph changed the title [ Latest Posts ] Max. number of words control don't react to keyboard input [ Latest Posts ] Max. number of words control doesn't react to keyboard input Apr 14, 2020
@kirilzh kirilzh self-assigned this Apr 28, 2020
@kirilzh
Copy link
Contributor

kirilzh commented May 4, 2020

It’s happening because

<RangeControl
  	min={ MIN_EXCERPT_LENGTH }
	max={ MAX_EXCERPT_LENGTH }
/>

has 10-100 set as lower and upper bounds. Whenever you try to go single digit it would prevent you from typing. Same goes when you exceed 100. I was thinking maybe to make it from 1-100 because it would make fixing ones easier and also maybe show a tooltip whenever an invalid number is typed. Also when should a fallback value be set? If there’s no lower bound, emptying the field is allowed, which currently automatically sets it to 50.

@aduth
Copy link
Member

aduth commented May 4, 2020

@kirilzh I seem to recall that the component previously had built-in logic which would allow for temporary "violations" of the validation. It was implemented in #12952, I believe (cc @jorgefilipecosta). It looks like the changes in the refactoring in #19916 removed some of the logic around this, perhaps inadvertently regressing this intended behavior:

https://github.com/WordPress/gutenberg/pull/19916/files#diff-d9d2996da619bb1351e858132191dbbeL51

cc @ItsJonQ

With a fix, it would be good to have some automated tests which verify this behavior, to avoid potential future regressions.

@ItsJonQ
Copy link

ItsJonQ commented May 4, 2020

@aduth Thank you for the heads up! I wasn't aware of this use case. I'll look into it now!

@github-actions github-actions bot added the [Status] In Progress Tracking issues with work in progress label May 4, 2020
@ItsJonQ
Copy link

ItsJonQ commented May 4, 2020

Just submitted a PR for the fix 🙏
#22084

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Block] Latest Posts Affects the Latest Posts Block [Status] In Progress Tracking issues with work in progress [Type] Bug An existing feature does not function as intended
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants