Skip to content
This repository has been archived by the owner on Jan 4, 2022. It is now read-only.

input field set to readonly conflicting with BMD classes #69

Open
marknl opened this issue Oct 31, 2017 · 4 comments
Open

input field set to readonly conflicting with BMD classes #69

marknl opened this issue Oct 31, 2017 · 4 comments

Comments

@marknl
Copy link

marknl commented Oct 31, 2017

I've tried to reconstruct the issue in a codepen, but it doesn't seem to work at all there.
https://codepen.io/marknl/pen/rYVGmQ

Here's a screenshot: https://imgur.com/a/n6rNy

When you define a select object, dropdownjs creates a div with an input element op top of the original select. this input element is given the attribute "readonly". This introduces a visual issue when using Bootstrap Material Design v4 (master) as well. The select is shown greyed out in css class:

.custom-file-control:disabled, .form-control:disabled, .form-control[readonly], [readonly].custom-file-control {
    background-color: #e9ecef;
    opacity: 1;
}

It's the input that makes it grey, and I agree that it should be readonly to prevent typing in the input field, since it should only contain valid select options. You can of course, overrule the background-color in a css class, but this readonly also has consequences for more css styles bdm applies, like the rippled line underneath the select. It now stays grey instead of green-ish default.

@FezVrasta
Copy link
Owner

If it can't be reproduced in the codepen it means it's some of your custom CSS that is generating the error.

@marknl
Copy link
Author

marknl commented Nov 1, 2017

I can't get the dropdown to work at all in the codepen is what I meant. Turns out you cannot include JS from raw github, since it returns text/plain .. strict MIME checking.

Anyway, I have it working in the same codepen right now, and the issues still stands.
https://codepen.io/marknl/pen/rYVGmQ

@FezVrasta FezVrasta reopened this Nov 1, 2017
@FezVrasta
Copy link
Owner

Thanks, it should be enough to set background-color: transparent in the CSS of dropdown.js.

Feel free to send a PR to fix it.

@marknl
Copy link
Author

marknl commented Nov 1, 2017

I tried that, that indeed fixes the background-color, but then the ripple color of the line underneath the input element is not in the right color (teal). That's because of this css class:

.custom-file-control:read-only, .form-control:read-only {
    background-image: linear-gradient(0deg,rgba(0,0,0,.26) 1px,transparent 0),linear-gradient(0deg,rgba(0,0,0,.26) 1px,transparent 0);
}

.form-control:read-only is making it grey.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants