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

Set max text height to prevent overflow #18862

Merged
merged 2 commits into from Feb 23, 2022

Conversation

kdumontnu
Copy link
Contributor

Sets a max height for review text boxes to prevent a very annoying bug where users cannot access the "submit" button.

Before:
image

After:
image

Interestingly, I don't see this bug on Firefox.

@GiteaBot GiteaBot added the lgtm/need 1 This PR needs approval from one additional maintainer to be merged. label Feb 23, 2022
@techknowlogick techknowlogick added this to the 1.17.0 milestone Feb 23, 2022
@techknowlogick techknowlogick added backport/v1.16 type/bug topic/ui Change the appearance of the Gitea UI labels Feb 23, 2022
@silverwind
Copy link
Member

I think this is an issue with the overall page layout where something prevents this dropdown from creating scrollable page overflow.

That said, this fix does not seem to work in all cases. I still see dropdown cut off on small vertical viewport.

Also I found a potentially related comment here:

// the editor's height is too large in some cases, and the panel cannot be scrolled with page now because there is `.repository .diff-detail-box.sticky { position: sticky; }`
// the temporary solution is to make the editor's height smaller (about 4 lines). GitHub also only show 4 lines for default. We can improve the UI (including Dropzone area) in future
await createCommentEasyMDE($reviewBox.find('textarea'), {minHeight: '80px'});
.

Copy link
Contributor

@wxiaoguang wxiaoguang left a comment

Choose a reason for hiding this comment

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

  1. EasyMDE has it's own options, see https://github.com/Ionaru/easy-markdown-editor , maxHeight , and our code already supports the customized options, grep createCommentEasyMDE(textarea, easyMDEOptions = {})
  2. calc(100vh - 920px) is incorrect. What if 100vh=930px, then minaxHeight=10px? , if we set minHeight and maxHeight together, then minHeight works if maxHeight is less.

@silverwind
Copy link
Member

We should not need to deal with max-height at all. Instead we should allow the page to overflow in such a case. If content goes below the footer, that's okay, I see it happening on GitHub too.

@wxiaoguang
Copy link
Contributor

wxiaoguang commented Feb 23, 2022

GitHub's behavior is indeed better.

At that time, minHeight was enough for most cases, and .diff-detail-box.sticky { position: sticky; } makes the page difficult to be overflowed with scrollbar, so I just left a comment there (I hadn't looked into it carefully, maybe I was wrong).

Although there might need some more CSS work, making the page can be overflowed correctly could be better.

Either is fine to me and I can also accept that we use maxHeight here as a temporary solution as this PR.

@silverwind
Copy link
Member

position: sticky alone does not prevent overflow. There's something else preventing it, but it's at least no obvious to me.

@GiteaBot GiteaBot added lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. and removed lgtm/need 1 This PR needs approval from one additional maintainer to be merged. labels Feb 23, 2022
@kdumontnu
Copy link
Contributor Author

That said, this fix does not seem to work in all cases. I still see dropdown cut off on small vertical viewport.

Mmm, I see what you mean. I can see it cut off with client height < 400px, which is pretty tiny. Still, I'm not sure how to fix the innate overflow issue and I think this is significantly improved.

@kdumontnu
Copy link
Contributor Author

kdumontnu commented Feb 23, 2022

Looks like GitHub is broken too, so we can claim feature parity! GitHub breaks at ~450px height, so I call that a win 😄
image

@zeripath zeripath merged commit f7085f7 into go-gitea:main Feb 23, 2022
@zeripath
Copy link
Contributor

Please send backport.

zjjhot added a commit to zjjhot/gitea that referenced this pull request Feb 24, 2022
* giteaofficial/main:
  Fix ldap user sync missed email in email_address table (go-gitea#18786)
  Update assignees check to include any writing team and change org sidebar (go-gitea#18680)
  Set max text height to prevent overflow (go-gitea#18862)
  Lock gofumpt to v0.3.0 and run it (go-gitea#18866)
fnetX pushed a commit to fnetX/gitea that referenced this pull request Mar 2, 2022
Sets a max height for review text boxes to prevent a very annoying bug where users cannot access the "submit" button.

Before:
![image](https://user-images.githubusercontent.com/12700993/155253001-e1dab086-aaf3-4338-889d-6a861728274a.png)

After:
![image](https://user-images.githubusercontent.com/12700993/155253144-5b9a3547-9582-412f-867f-41a45a14a0fe.png)

Interestingly, I don't see this bug on Firefox.
@6543 6543 added the backport/done All backports for this PR have been created label Mar 2, 2022
zeripath pushed a commit that referenced this pull request Mar 2, 2022
Sets a max height for review text boxes to prevent a very annoying bug where users cannot access the "submit" button.

Before:
![image](https://user-images.githubusercontent.com/12700993/155253001-e1dab086-aaf3-4338-889d-6a861728274a.png)

After:
![image](https://user-images.githubusercontent.com/12700993/155253144-5b9a3547-9582-412f-867f-41a45a14a0fe.png)

Interestingly, I don't see this bug on Firefox.

Co-authored-by: Kyle D <kdumontnu@gmail.com>
@CirnoT
Copy link
Contributor

CirnoT commented Mar 4, 2022

Was it the intention of this PR to create this situation?

firefox_2022-03-04_17-35-59
firefox_2022-03-04_17-36-18
firefox_2022-03-04_17-36-57

It would seem that this doesn't apply max-height but min-height instead:
firefox_2022-03-04_17-41-13

firefox_2022-03-04_17-41-00

@wxiaoguang
Copy link
Contributor

It seems that EasyMDE can not handle minHeight and maxHeight together correctly, and no one found this problem during code review.

I think we had better revert this PR and propose a new proper one.

@wxiaoguang
Copy link
Contributor

The PR to fix it:

zeripath pushed a commit that referenced this pull request Mar 4, 2022
zeripath pushed a commit to zeripath/gitea that referenced this pull request Mar 19, 2022
lunny pushed a commit that referenced this pull request Mar 20, 2022
Backport #19003

Fix the height problem in  #18862 (comment)

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
Chianina pushed a commit to Chianina/gitea that referenced this pull request Mar 28, 2022
Sets a max height for review text boxes to prevent a very annoying bug where users cannot access the "submit" button.

Before:
![image](https://user-images.githubusercontent.com/12700993/155253001-e1dab086-aaf3-4338-889d-6a861728274a.png)

After:
![image](https://user-images.githubusercontent.com/12700993/155253144-5b9a3547-9582-412f-867f-41a45a14a0fe.png)

Interestingly, I don't see this bug on Firefox.
Chianina pushed a commit to Chianina/gitea that referenced this pull request Mar 28, 2022
@go-gitea go-gitea locked and limited conversation to collaborators Apr 28, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
backport/done All backports for this PR have been created lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. topic/ui Change the appearance of the Gitea UI type/bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

8 participants