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: larger names shrunk in variable tab #5

Merged
merged 1 commit into from
Nov 11, 2024

Conversation

abdul99ahad
Copy link
Contributor

@abdul99ahad abdul99ahad commented Oct 30, 2024

Related to: camunda/camunda-modeler#4505

Proposed Changes

Truncate variable names exceeding max width with ellipses for improved readability
Screenshot 2024-11-06 at 15 13 56

Checklist

To ensure you provided everything we need to look at your PR:

  • Brief textual description of the changes present
  • Visual demo attached
  • Steps to try out present, i.e. using the @bpmn-io/sr tool
  • Related issue linked via Closes {LINK_TO_ISSUE} or Related to {LINK_TO_ISSUE}

@nikku
Copy link
Member

nikku commented Oct 30, 2024

@misiekhardcore Assigning you for review. Please have a look. 👀

@misiekhardcore
Copy link

misiekhardcore commented Oct 31, 2024

Can you tell me how to tests that? I have no idea how to run this locally so I can see if it works
I guess I need to use npm run start?

@nikku
Copy link
Member

nikku commented Oct 31, 2024

I guess I need to use npm run start?

That is our general practice, it works in well maintained projects.

Copy link

@misiekhardcore misiekhardcore left a comment

Choose a reason for hiding this comment

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

So few questions/observations

  1. When you changed the display from flex to inline-block, the alignment of the elements broke (it is not centered anymore) also the max-width caused the element does not have the full with of the list
    Screenshot from 2024-10-31 11-28-35
  2. when the ellipsis kicks in, you are not able anymore to see the full name in any way. I would suggest adding a title prop so when user hovers over the list item, the full label pops up
  3. Also kinda related question, shouldn't also some kind of overflow prevention be done to the diagram elements themselves? Cause now when you give an element a long name, it overflows the eleemnt
    Screenshot from 2024-10-31 10-21-29
  4. maybe a better approach to ellipsis is just preventing the svg element with flex-shrink: 0?

@bpmn-io-tasks bpmn-io-tasks bot added in progress Currently worked on and removed needs review Review required labels Oct 31, 2024
@misiekhardcore
Copy link

@nikku I won't argue with that, I just know different approaches, like npm run dev to run project in development and npm run start to run a built version

@nikku
Copy link
Member

nikku commented Oct 31, 2024

In our sphere:

  • npm run dev spins up our development environment, whatever that is (usually it is a web test runner with the ability to execute individual tests / debug individual test scenarios).
  • npm start spins up a demo environment that allows me to test a thing, as E2E as possible, this means it incorporates other components that are needed for reasonable e2e experience.

You can try npm run dev and npm start in this repository, and you'll see what I mean.

@nikku
Copy link
Member

nikku commented Oct 31, 2024

If this repository does not live up to our standards, then we want to lift it up 🙂

@abdul99ahad abdul99ahad force-pushed the tree-node-elements-style-fix branch from 9212c53 to 9d5d4fb Compare November 4, 2024 14:52
@abdul99ahad
Copy link
Contributor Author

So few questions/observations

  1. When you changed the display from flex to inline-block, the alignment of the elements broke (it is not centered anymore) also the max-width caused the element does not have the full with of the list
    Screenshot from 2024-10-31 11-28-35
  2. when the ellipsis kicks in, you are not able anymore to see the full name in any way. I would suggest adding a title prop so when user hovers over the list item, the full label pops up
  3. Also kinda related question, shouldn't also some kind of overflow prevention be done to the diagram elements themselves? Cause now when you give an element a long name, it overflows the eleemnt
    Screenshot from 2024-10-31 10-21-29
  4. maybe a better approach to ellipsis is just preventing the svg element with flex-shrink: 0?

So few questions/observations

  1. When you changed the display from flex to inline-block, the alignment of the elements broke (it is not centered anymore) also the max-width caused the element does not have the full with of the list
    Screenshot from 2024-10-31 11-28-35
  2. when the ellipsis kicks in, you are not able anymore to see the full name in any way. I would suggest adding a title prop so when user hovers over the list item, the full label pops up
  3. Also kinda related question, shouldn't also some kind of overflow prevention be done to the diagram elements themselves? Cause now when you give an element a long name, it overflows the eleemnt
    Screenshot from 2024-10-31 10-21-29
  4. maybe a better approach to ellipsis is just preventing the svg element with flex-shrink: 0?

Thanks for your feedback and suggestions!

  1. I've fixed the alignment issue; it turns out we only needed to apply the styles to child elements rather than to all tree nodes, so they now appear centered correctly.
  2. Adding a title prop overlay might be redundant here since clicking the variable name takes you directly to the element, where the full name is displayed. Let me know if you feel differently!
  3. Great point about overflow prevention on the diagram elements themselves. While it’s outside the current scope, it would be a valuable addition. Feel free to open a new issue for this so we can add it to the backlog.
  4. I tried setting flex-shrink: 0 on the SVG, but it didn’t achieve the intended result. If you have ideas for a different approach, I'd be happy to review a PR.

@bpmn-io-tasks bpmn-io-tasks bot added needs review Review required and removed in progress Currently worked on labels Nov 4, 2024
Copy link

@misiekhardcore misiekhardcore left a comment

Choose a reason for hiding this comment

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

It is better already cause the element takes the whole space as it should and the ellipsis is there, but the alignment issue remains. You set display: inline-block on the element and at the same time the align-items: center which works only with flex box so it does not work and there is no horizontal alignment between svg and text

Screenshot from 2024-11-05 17-11-20

I think we need to wrap the text in its separate element to give it the ellipsis so the whole .cds--tree-node__label box can stay flex.
Regarding flex-shrink: 0 I am not sure why setting it on .cds--tree-node__label svg doesn't work for you.

Also, maybe worth looking into as well cause it is related, maybe not, text overflowing issue occurs for process name
Screenshot from 2024-11-05 17-12-19

And lastly, if you want to have a look together or talk about it feel free to ping me

@bpmn-io-tasks bpmn-io-tasks bot added in progress Currently worked on and removed needs review Review required labels Nov 5, 2024
@abdul99ahad abdul99ahad force-pushed the tree-node-elements-style-fix branch from 9d5d4fb to 4a69e33 Compare November 6, 2024 10:13
@abdul99ahad
Copy link
Contributor Author

It is better already cause the element takes the whole space as it should and the ellipsis is there, but the alignment issue remains. You set display: inline-block on the element and at the same time the align-items: center which works only with flex box so it does not work and there is no horizontal alignment between svg and text

Screenshot from 2024-11-05 17-11-20

I think we need to wrap the text in its separate element to give it the ellipsis so the whole .cds--tree-node__label box can stay flex. Regarding flex-shrink: 0 I am not sure why setting it on .cds--tree-node__label svg doesn't work for you.

Also, maybe worth looking into as well cause it is related, maybe not, text overflowing issue occurs for process name Screenshot from 2024-11-05 17-12-19

And lastly, if you want to have a look together or talk about it feel free to ping me

Thanks for your suggestions. I have incorporated your feedback and alignment issues of svg and text are now resolved. Ready for review.

@bpmn-io-tasks bpmn-io-tasks bot added needs review Review required and removed in progress Currently worked on labels Nov 6, 2024
Copy link

@misiekhardcore misiekhardcore left a comment

Choose a reason for hiding this comment

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

This starts to look really good! Just two minor suggestions and we are good

lib/Components/ElementList/ElementList.scss Outdated Show resolved Hide resolved
lib/Components/ElementList/ElementList.jsx Show resolved Hide resolved
@abdul99ahad abdul99ahad force-pushed the tree-node-elements-style-fix branch from 4a69e33 to 35adbfa Compare November 11, 2024 08:30
Related to: camunda-modeler #4505
@abdul99ahad abdul99ahad force-pushed the tree-node-elements-style-fix branch from 35adbfa to c9bbf3b Compare November 11, 2024 08:33
@abdul99ahad abdul99ahad merged commit 4420394 into main Nov 11, 2024
4 checks passed
@bpmn-io-tasks bpmn-io-tasks bot removed the needs review Review required label Nov 11, 2024
@abdul99ahad abdul99ahad deleted the tree-node-elements-style-fix branch November 11, 2024 15:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants