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

fix(content): prevent editor extending on typing #933

Merged
merged 1 commit into from Oct 21, 2021

Conversation

NozomuIkuta
Copy link
Collaborator

@NozomuIkuta NozomuIkuta commented Jul 28, 2021

Types of changes

  • Bug fix (a non-breaking change which fixes an issue)
  • New feature (a non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Description

Resolves: #932

In addition, I adjusted some CSS styles of textarea element.

Checklist:

  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes (if not applicable, please state why)

This is UI bug, so there is nothing to change in unit tests.
Instead, I tested it in Chrome (91.0.4472.164), Firefox (90.0.2), and Safari (14.1.1) on MacBookPro (Big Sur).

Case 1: Type some characters and confirm that textarea doesn't extend on every typing.
Case 2: Type enter key several times and confirm that textarea extends by as many lines as needed.
Case 3: Delete several lines and confirm that textarea shrinks by as many lines as needed.

Comment on lines +101 to +106
box-sizing: border-box;
display: block;
width: 100%;
padding: 8px;
overflow: hidden;
resize: none;
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

width: 100% + horizontal padding means the element overflows parents width.
So I added box-sizing: border-box.

Default style of textarea is display: inline-block but I explicitly set it as block (maybe this is just preference).

overflow: hidden is to make situation simple and prevent redundant scroll bar from appearing.

resize: none is also to make situation simple. That is, with overflow: hidden, if developer shrinks textarea vertically, overflown lines are hidden.

@NozomuIkuta NozomuIkuta added bug Something isn't working theme-v1 Concerns @nuxt/content-theme-docs and removed theme-v1 Concerns @nuxt/content-theme-docs labels Sep 22, 2021
@pi0 pi0 merged commit d4dce1e into nuxt:main Oct 21, 2021
@NozomuIkuta NozomuIkuta deleted the fix/editor-extending branch October 21, 2021 18:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

The live editor expands by one row for each character typed
2 participants