Skip to content

fix(ui5-tokenizer): proper calculation of tokenizer overflow width - #14105

Open
nikoletavnv wants to merge 1 commit into
mainfrom
tokenizer-nmore-fix
Open

nikoletavnv wants to merge 1 commit into
mainfrom
tokenizer-nmore-fix

Conversation

@nikoletavnv

Copy link
Copy Markdown
Contributor

Fixes: #14067

@nikoletavnv
nikoletavnv deployed to netlify-preview September 29, 2026 14:49 — with GitHub Actions Active
@sap-ui5-webcomponents-release

Copy link
Copy Markdown

@Vonahz
Vonahz self-requested a review October 1, 2026 11:34

@Vonahz Vonahz left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I found two issues:

  1. With this change, there is case when the tokenizer is cut on the right side:
Image

To reproduce this issue, set first token of many to "And" and set width of tokenizer to "109px"

  1. In RTL page we still have the issue as the fix takes always the right side of the tokenizer.

const boundaryRect = boundaryDom.getBoundingClientRect();
const parentRect = this.contentDom.getBoundingClientRect();
const parentEnd = Number(parentRect.right.toFixed(2));
const parentEnd = Number(boundaryRect.right.toFixed(2));

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Both are named parent* but they measure two different DOM nodes. That's the core naming lie — a reader reasonably assumes parentStart/parentEnd are the two edges of the same "parent" container.

// For the last token, check if it fits without "n more"
// For other tokens, check if token + "n more" fits together
const effectiveParentEnd = isLastToken ? parentEnd : Number((parentRect.right - nMoreWidth).toFixed(2));
const effectiveParentEnd = isLastToken ? parentEnd : Number((boundaryRect.right - nMoreWidth).toFixed(2));

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Also here instead of parentEnd we need something like rootEnd

This branch was successfully deployed

1 active deployment
netlify-preview — 588ab3aa Deployed Sep 29, 2026 by nikoletavnv via deploy-preview #3412
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.

[ui5-tokenizer: incorrect overflow calculations]:

2 participants