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

[MM-54367] Apply scope to the menu class #213

Merged
merged 5 commits into from
Sep 28, 2023

Conversation

kyeongsoosoo
Copy link
Contributor

Summary

Related conversation: https://community.mattermost.com/core/pl/cfk9y3o8jpy9tn4dhz4cd4ioqr

I found that the Todo plugin's css affects the entire Menu component.
I applied scope to the Menu component.

Ticket Link

Fixes mattermost/mattermost#24455
Jira https://mattermost.atlassian.net/browse/MM-54367

@kyeongsoosoo
Copy link
Contributor Author

I found that the Button and Chip component have the same bugs. (https://github.com/mattermost/mattermost-plugin-todo/blob/a309a7ab63f0ea0ec7b91e7f46b22045e84ee08e/webapp/src/widget/buttons/button.scss#L1)
Would it be better to fix them together in this PR?

.Menu,
.SubMenuOption .SubMenu {
.TodoMenu,
.SubTodoMenuOption .SubTodoMenu {
Copy link
Contributor

Choose a reason for hiding this comment

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

I see changes in the code for Menu->TodoMenu. Is there any change for SubMenuOption->SubTodoMenuOption needed?

Copy link
Contributor Author

@kyeongsoosoo kyeongsoosoo Sep 15, 2023

Choose a reason for hiding this comment

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

I think it's not needed now. I added it for the future use-case.

Copy link
Contributor

Choose a reason for hiding this comment

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

If there is no class name being used in the components SubTodoMenuOption or SubTodoMenu, then I think they should be removed from the scss file to avoid confusion. Likely, yagni

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@mickmister I removed the unused classnames.

@larkox larkox mentioned this pull request Sep 15, 2023
Copy link
Contributor

@mickmister mickmister left a comment

Choose a reason for hiding this comment

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

Thanks for catching this and implementing the fix @kyeongsoosoo 👍

The changes LGTM. I just have one non-blocking suggestion to remove the class names from the scss file that are not being used in the React code SubTodoMenuOption and SubTodoMenu

@@ -19,7 +19,7 @@ const MenuWrapper = React.memo((props: Props) => {
const [open, setOpen] = useState(Boolean(props.isOpen));

if (!Array.isArray(props.children) || props.children.length !== 2) {
throw new Error('MenuWrapper needs exactly 2 children');
throw new Error('TodoMenuWrapper needs exactly 2 children');
Copy link
Contributor

Choose a reason for hiding this comment

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

The component should probably be renamed to TodoMenuWrapper if we change this error message

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I reverted it back to MenuWrapper to keep it the same as the other components.

.Menu,
.SubMenuOption .SubMenu {
.TodoMenu,
.SubTodoMenuOption .SubTodoMenu {
Copy link
Contributor

Choose a reason for hiding this comment

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

If there is no class name being used in the components SubTodoMenuOption or SubTodoMenu, then I think they should be removed from the scss file to avoid confusion. Likely, yagni

Comment on lines 1 to +2
.status-dropdown-menu {
> .Menu {
> .TodoMenu {
Copy link
Contributor

Choose a reason for hiding this comment

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

Unrelated to this PR, but it seems wrong to assume that the plugin's TodoMenu component will always be a next-level descendant of the element that has status-dropdown-menu class name

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I thought it would be okay because position is applied separately to the TodoMenu classname.
https://github.com/mattermost/mattermost-plugin-todo/blob/a309a7ab63f0ea0ec7b91e7f46b22045e84ee08e/webapp/src/widget/menu.scss#L7-L10

Copy link
Contributor

Choose a reason for hiding this comment

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

Right, but .status-dropdown-menu is managed by the core webapp. At any point, the webapp could restructure itsrlf and do one of:

  • Remove that class name altogether
  • Change its component structure to have a component in between .status-dropdown-menu and the plugin's component

Both of these would make it so our plugin styles don't get used. The alternative is to not have the > in the selector

@mickmister mickmister added the 3: QA Review Requires review by a QA tester label Sep 19, 2023
Copy link

@AayushChaudhary0001 AayushChaudhary0001 left a comment

Choose a reason for hiding this comment

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

@mickmister @kyeongsoosoo
The issue has been solved in this PR. The UI does not get hampered through this fix, but the user is still able to resize the LHS while the channel menu is opened.
Steps to reproduce:-

  1. Open the channel menu.
  2. Try to resize the LHS.

The user is able to resize the LHS which contrasts the expected result in the issue.

Screenshot from 2023-09-20 16-43-15

@mickmister
Copy link
Contributor

@AayushChaudhary0001 I think the issue you point out may be unrelated to this PR. If the issue the PR intends to fix is fixed by this PR, can you please approve it? We can make a separate issue for the main repository if there's an unrelated issue

@mickmister
Copy link
Contributor

@kyeongsoosoo Heads up that there are some linting issues to resolve on the PR

@marianunez marianunez removed the request for review from yasserfaraazkhan September 27, 2023 14:27
@hanzei hanzei added the Awaiting Submitter Action Blocked on the author label Sep 27, 2023
@codecov-commenter
Copy link

codecov-commenter commented Sep 27, 2023

Codecov Report

All modified lines are covered by tests ✅

Comparison is base (a309a7a) 6.42% compared to head (b647dc5) 6.42%.

❗ Current head b647dc5 differs from pull request most recent head 9f5404d. Consider uploading reports for the commit 9f5404d to get more accurate results

Additional details and impacted files
@@          Coverage Diff           @@
##           master    #213   +/-   ##
======================================
  Coverage    6.42%   6.42%           
======================================
  Files          11      11           
  Lines        1712    1712           
======================================
  Hits          110     110           
  Misses       1594    1594           
  Partials        8       8           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@kyeongsoosoo
Copy link
Contributor Author

/update-branch

@kyeongsoosoo
Copy link
Contributor Author

@mickmister Could you help me re-run the test? I fixed the linting issue.
The issue was on the server side. It's not PR related, but it was a minor change, so I fixed it.

@mickmister
Copy link
Contributor

mickmister commented Sep 27, 2023

@kyeongsoosoo Thanks for providing a fix 👍

@mickmister mickmister removed the Awaiting Submitter Action Blocked on the author label Sep 27, 2023
@AayushChaudhary0001
Copy link

@mickmister Yes, I am approving this PR and we can create a different issue for this, but in the description of the PR, the expected result in the mentioned ticket should be similar to what has been tested, so kindly update that.

@mickmister
Copy link
Contributor

mickmister commented Sep 28, 2023

@kyeongsoosoo Merging this, as it's obvious the issue that this plugin was causing is fixed. Is it your understanding that mattermost/mattermost#24455 is solved, or is there additional work to be done in the main repo to completely resolve the issue?

@mickmister mickmister merged commit 1aa947c into mattermost-community:master Sep 28, 2023
4 checks passed
@kyeongsoosoo
Copy link
Contributor Author

@mickmister Sorry for the late reply.
I think the ticket is solved. The issue mentioned above was not in the spec at the time of implementation, so I don't think it is a bug that should be fixed in this ticket.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3: QA Review Requires review by a QA tester
Projects
None yet
Development

Successfully merging this pull request may close these issues.

LHS resize is overriding with Browse/ Create Channel Menu
6 participants