Skip to content

fix(form-field): ie fixes: apply vertical alignment on select, tree-select #211

Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions packages/mosaic/select/select.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -891,7 +891,7 @@ export class McSelect extends McSelectMixinBase implements

private getTotalItemsWidthInMatcher(): number {
const triggerClone = this.trigger.nativeElement.cloneNode(true);
triggerClone.querySelector('.mc-select__match-hidden-text').remove();
this._renderer.removeChild(triggerClone, triggerClone.querySelector('.mc-select__match-hidden-text'));

this._renderer.setStyle(triggerClone, 'position', 'absolute');
this._renderer.setStyle(triggerClone, 'visibility', 'hidden');
Expand All @@ -902,11 +902,15 @@ export class McSelect extends McSelectMixinBase implements

let totalItemsWidth: number = 0;
const itemMargin: number = 4;
triggerClone.querySelectorAll('mc-tag').forEach((item) => {
totalItemsWidth += item.getBoundingClientRect().width as number + itemMargin;
});

triggerClone.remove();
const mcTags = triggerClone.querySelectorAll('mc-tag');
const mcTagsLength = mcTags.length;

for (let i = 0; i < mcTagsLength; i++) {
tverskih marked this conversation as resolved.
Show resolved Hide resolved
totalItemsWidth += mcTags[i].getBoundingClientRect().width as number + itemMargin;
}

this._renderer.removeChild(this.trigger.nativeElement, triggerClone);

return totalItemsWidth;
}
Expand Down
2 changes: 2 additions & 0 deletions packages/mosaic/select/select.scss
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ $mc-select-placeholder-arrow-space: 2 * ($mc-select-arrow-size + $mc-select-arro

display: inline-block;

// Fix IE aligning - default align in IE is baseline, not the middle of element
vertical-align: top;
width: 100%;

outline: none;
Expand Down
3 changes: 3 additions & 0 deletions packages/mosaic/tree-select/tree-select.scss
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ $mc-select-placeholder-arrow-space: 2 * ($mc-select-arrow-size + $mc-select-arro

display: inline-block;

// Fix IE aligning - default align in IE is baseline, not the middle of element
vertical-align: top;

width: 100%;

outline: none;
Expand Down