angular / angular/components

feat(select): allow auto-width based on placeholder / value

オープン
#7,627 コメント 12 件 リアクション 30 件 担当者 0 名 GitHub で見る
area: material/select feature P3
主要言語
TypeScript
スター
25k
フォーク
6.8k
平均マージ
1日 8時間
マージ済み PR(30日)
91

説明

### fixed width on mat-form-field
I want my select to have the width of the selected item, fixed width on mat-form-field makes it impossible, you can override `.mat-form-field` to have `width` `auto`, along with overriding `.mat-select-value` to be `width` `auto` and `max-width` `100%`, but then you have a problem, because placeholder is absolutely positioned, which means that the select without any value set yet will be zero width (actually 18px because of the arrow).

https://stackblitz.com/edit/material2-select-width-issues?file=styles.scss

Now I could also override placeholders not to be absolutely positioned, but that's not gonna work properly either, because the arrow is inside the `md-select` element, while the placeholder is outside

![image](https://user-images.githubusercontent.com/1303561/31315390-330fa1e6-ac18-11e7-8b95-a19923299262.png)

I'm not sure if that 200px width is something that's on material spec, but the DOM could perhaps be structured a bit differently, in a way that wouldn't prevent devs from achieving fluid width (which is a bit closer to how native selects work)

## different height when selected vs. placeholder
![image](https://user-images.githubusercontent.com/1303561/31315458-4a4e4276-ac19-11e7-8d0d-98b9058da2c7.png)

cc @crisbeto

コントリビューションガイド

コントリビューションガイドを開く

調査の方向性

リンクされた StackBlitz の再現から始め、fixed-width と placeholder のケースに関係する mat-form-field と mat-select の構造を調査します。空の placeholder と選択された値の両方について、現在の動作を要求されている auto-width の動作と比較します; select が矢印や placeholder のレイアウトを壊さずに柔軟にサイズ調整できれば完了です。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
angular, typescript
領域
design, frontend
issue の種類
機能追加
難易度
5/5
見積もり時間
1週間以上
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
30/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。