Skip to content

Conversation

@subashtiwari1010
Copy link
Contributor

Description

This PR updates the style of the square buttons, and adds the border radius in button, inputs and selectors as per the requirement in #10954.

Please check if the PR fulfills these requirements

What kind of change does this PR introduce? (check one with "x", remove the others)

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Other... Please describe:

Issue

What is the current behavior?
The buttons were categorized in small, medium and default size. And the components did not have the border radius to them.
Fixes #10954

What is the new behavior?
All the buttons are now categorized under square-button only. Other categories of square-button-md and square-button-sm are deprecated. Also, the border radius have been implemented in the button, inputs and select components.

Breaking change

Does this PR introduce a breaking change? (check one with "x", remove the other)

  • Yes, and I documented them in migration notes
  • No

Other useful information

Comment on lines 211 to 223
export const markEdgesForToolbar = (el) => {
if (!el) return;
const buttons = Array.from(el.querySelectorAll('button'));
// filter out excluded + invisible
const eligible = buttons.filter((btn) => isVisible(btn));
// remove old markers
buttons.forEach((btn) => btn.classList.remove('is-first', 'is-last'));
// mark new first/last
if (eligible.length > 0) {
eligible[0].classList.add('is-first');
eligible[eligible.length - 1].classList.add('is-last');
}
};
Copy link
Contributor

Choose a reason for hiding this comment

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

We should not manipulate directly classes in the DOM, in general we should give priority on react or css solutions and as last resource access to the DOM trying to reduce at minimum the manipulation.

Here my suggestion is to only find which are the first and last indices of the visible button and then inside the React component use useState to store and add the classes to the div wrapper

export const getEdgesIndexForToolbar = (el) => {
    if (!el) return [];
    const eligible = [...(el.children || [])].map((child, idx) => [idx, child]).filter((entry) => entry[1].children.length > 0 && entry[1].style.visibility !== 'hidden');
    const [firstIndex] = eligible[0] || [];
    const [lastIndex] = eligible[eligible.length - 1] || [];
    return [firstIndex, lastIndex];
};

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated the function to use the above implementation instead of using the DOM manipulation.

const width = ref.current.clientWidth;
const scrollWidth = ref.current.scrollWidth;
const overflow = width < scrollWidth;
markEdgesForToolbar(ref.current);
Copy link
Contributor

Choose a reason for hiding this comment

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

Here we could add a internal useState:

setEdgesIndex(getEdgesIndexForToolbar(ref.current));

and then apply the class to the div wrapper only if the idx match the first and last visible not empty item

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Used the new function here to set the edges button index and used the index to set the class in the component.

@allyoucanmap
Copy link
Contributor

@subashtiwari1010 I started to review the PR but not completed it yet. You can start to address the changes requested in this initial review, thanks

@tdipisa tdipisa added the BackportNeeded Commits provided for an issue need to be backported to the milestone's stable branch label Nov 4, 2025
@tdipisa tdipisa modified the milestones: 2025.02.00, 2026.01.00 Nov 4, 2025
@tdipisa tdipisa removed the BackportNeeded Commits provided for an issue need to be backported to the milestone's stable branch label Nov 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Review overall app buttons style

4 participants