Skip to content

Update minWidth on dimension updates#6696

Draft
duncanuszkay-d2l wants to merge 1 commit intomainfrom
dunk.width-updates
Draft

Update minWidth on dimension updates#6696
duncanuszkay-d2l wants to merge 1 commit intomainfrom
dunk.width-updates

Conversation

@duncanuszkay-d2l
Copy link
Contributor

@duncanuszkay-d2l duncanuszkay-d2l commented Mar 19, 2026

https://desire2learn.atlassian.net/browse/NTNGL-5248?atlOrigin=eyJpIjoiYWI2ZTc5N2ZjOTg2NDMxNTkxMmY2MjlmMjE1MTI0MzQiLCJwIjoiaiJ9

Opening this as a draft to see if I'm on the right track here before polishing it up, let me know what you think.

Problem

We were noticing that our date fields were reverting to the stacked/block form depending on the length of the column title rather than defaulting to a minimum width that would fit the dimensions in a row.

Recording.2026-03-19.132950.mp4

We don't like the UX/look of the stacked controls, so we wanted to ensure that they showed up in a line wherever possible.

Solution

While exploring with breakpoints, I noticed that updates to minimum width values within dimensions sets were not being propagated up to the filter like other values were. Then, since our column data arrived async after the filters are opened, by the time we had the minWidth data the dimension data was no longer being updated. As a result, the minWidth value supplied by the filter-dimension-set-date-time-range-value was being ignored.

In this PR, I've updated the dimension update code to also propagate the minWidth as a value up to the filter, and I've added a line in the filter to use that value to set its own minimum width.

Other details of the solution have been written inline.

Demo

Recording.2026-03-19.132843.mp4

this._enforceSingleSelection = true;
this._filterSetValue = true;
this._minWidth = 390;
this._minWidth = 410;
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 saw in the git blame that this 390 value was set explicitly to provide enough room with scroll bars. I'm not sure why, but it's insufficient in our case. We still get wrapping at 390. If we're concerned about the size increase here, I could explore why that is.

Copy link
Contributor

@dbatiste dbatiste Mar 20, 2026

Choose a reason for hiding this comment

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

Worth noting that 410 might only be sufficient for English. We're not necessarily aiming to make it fit for all languages without wrapping, but we at least would like it to not wrap in English, and hopefully some other languages too. We know there will be languages where wrapping will likely happen.

@github-actions
Copy link
Contributor

Thanks for the PR! 🎉

We've deployed an automatic preview for this PR - you can see your changes here:

URL https://live.d2l.dev/prs/BrightspaceUI/core/pr-6696/

Note

The build needs to finish before your changes are deployed.
Changes to the PR will automatically update the instance.

selected: this.selected,
text: this.text,
valueText: this.valueText,
minWidth: this._minWidth,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This adds the width into the object that is ultimately propagated up in the d2l-filter-dimension-data-change event

if (dimension.searchValue || dimension.searchType === 'manual') shouldSearch = true;
shouldRecount = true;
this._activeFiltersSubscribers.updateSubscribers();
newValue.forEach((field) => this._minWidth = field.minWidth ? field.minWidth : this._minWidth);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Now that the width is available in the details, we'll apply it.

Note that we're not doing any Math.min math here- we're just setting it with no regard for the prior value. This is consistent with the current implementation- I'm not sure why that's the case, but I'm making the assumption that there's a good reason for that, though I wonder if it's also just because there happens to only ever be one width that differs from the base value.

Let me know if that was just an oversight I should fix while I'm here.

Copy link
Contributor

Choose a reason for hiding this comment

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

We've had some discussion about this offline, and I think we're in agreement that we should apply a fix here. However, @bearfriend made a point about probably needing to do a max min-width, since we think the current fix would be relying on this being the last one (not overridden by a smaller min-width).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Makes sense- I figured it was just an oversight due to the coincidence of there only being one min width to apply ATM.

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 think we're in agreement that we should apply a fix here.

Anything I can do to help us be sure we should apply a fix here? 😸 Should we book a chat perhaps? Or will y'all figure it out on your end?

Copy link
Contributor

@dbatiste dbatiste Mar 20, 2026

Choose a reason for hiding this comment

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

Makes sense- I figured it was just an oversight due to the coincidence of there only being one min width to apply ATM.

Quite possible.

Anything I can do to help us be sure we should apply a fix here? 😸 Should we book a chat perhaps? Or will y'all figure it out on your end?

I'll create a ticket for this. We'll prioritize it against our other tickets, but if you want it right away, we can chat about contributing a fix.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

but if you want it right away, we can chat about contributing a fix.

We'd love to do the work for this on our end if possible- not necessarily a critical issue for our team, but we have the bandwidth to pick it up.

@duncanuszkay-d2l duncanuszkay-d2l requested a review from a team March 19, 2026 17:39
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.

2 participants