Skip to content

Fix custom file truncation#28511

Closed
MartijnCuppens wants to merge 1 commit intomasterfrom
master-mc-file-input-elipsis-fix
Closed

Fix custom file truncation#28511
MartijnCuppens wants to merge 1 commit intomasterfrom
master-mc-file-input-elipsis-fix

Conversation

@MartijnCuppens
Copy link
Copy Markdown
Member

Closes #28497

Alternative approach which doesn't depend on the width of the browse button. This solution is also compatible with the non-.text-truncate custom input, the text just gets cut off in that case.

@MartijnCuppens MartijnCuppens requested a review from a team as a code owner March 15, 2019 19:39
Comment thread scss/_custom-forms.scss
top: 0;
right: 0;
bottom: 0;
position: relative;
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.

Is this position:relative needed?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

z-index: 3 is set on this for some reason, not sure why but I didn't want to break anything I wasn't aware of. I'll have a look at why this was set and maybe we can indeed remove this.

@alecpl
Copy link
Copy Markdown
Contributor

alecpl commented Mar 16, 2019

I'm not sure this is supported scenario, but that margin trick will not work with .form-control-lg/.form-control-sm without additional code.

@MartijnCuppens
Copy link
Copy Markdown
Member Author

Good point, I'll have a look at that

@ysds
Copy link
Copy Markdown
Contributor

ysds commented Mar 19, 2019

I’m not a big fan of the current(v4) implementation using CSS content for the "Browse" text. It seems a bit tricky.

If DOM changes are allowed in v5, I'd like to propose like a following change:

<div class="custom-file">
  <input type="file" class="custom-file-input" id="customFile">
  <label class="custom-file-label" for="customFile">
    <span class="custom-file-text">Choose file</span>
    <span class="custom-file-button">Browse</span>
  </label>
</div>

This will not need negative margins.

@MartijnCuppens
Copy link
Copy Markdown
Member Author

I'm going to close this after feedback from @ysds & @alecpl. I think we should go the way @ysds is suggesting. I think we can also ditch the attr() hack mentioned here: #25497.

@ysds, could you have a look at this one of these days? (no pressure on this)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants