css styles are not getting applied in modal dialog - how can I fix?
React 16.13.1; Semantic UI React 2.0.2
Happens on Chrome, Firefox and Edge
I'm using SortableContainer
from react-sortable-hoc
package to make a UI for sorting an array. I'm having trouble with the css styling under the context that I'd like to use the package in. In a different context, it's behaving how I'd like.
Here's the context in which it's working. See notes below each image.
In the above image, the sortable list is in the lower left. This shows its idle state for context.
In the above image, note that the list item that's being dragged has a yellow border and the text is visible. The
SortableList
element creates a new element on-demand that gets dragged around. The styling is set by a class that's passed to the SortableList
element. In this case, the class is called file-upload-sortable-list-item-helper
, as seen in the Elements pane by the red arrow.
But I need the sortable list in its own modal window rather than in the table cell as shown above. But when I do that, the styling doesn't get set for the item as it's dragged. But first, here's the sortable list in a modal window at idle.
In the above picture, the sortable list is in a modal window and is at idle. So far so good.
In the above picture, the item that's being dragged is not styled properly, and is practically invisible (red arrow 1), even though the Elements pane is showing that the
file-upload-sortable-list-item-helper
is set for the item (red arrow 2).
I can't figure out how to get the Chrome dev tools to show me the item Style details for the dragged item, because if I enter element selection mode and click on the list item, it doesn't get activated for dragging. I have to then click again to start it dragging but by then the element selection mode is deactivated.
Here's the relevant style definitions
.file-upload-sortable-list {
list-style-type: none;
margin: auto;
width: 80%;
padding: 10px 5px;
}
.file-upload-sortable-list-item {
/*border-style: solid;*/
border: 1px solid;
text-align: center;
padding: 2px;
border-color: rgb(84,200,255);
border-radius: 4px;
}
/* This class is for the list item that moves
around when using the SortableList. Because
of how it's instantiated on-demand, it can't be
a child of .pennai.
The most important part is the z-index. Without it
the element isn't visible at all.
See https://github.com/clauderic/react-sortable-hoc/issues/87
*/
.file-upload-sortable-list-item-helper {
border: 2px solid;
text-align: center;
/* something happens to the padding compared to the regular item defined above,
and the text is aligned at bottom of border instead of middle.
But these settings aren't effecting things. Huh.
*/
padding-top: 0 !important;
padding-bottom: 5px !important;
border-color: yellow; /* rgb(84,200,255);*/
border-radius: 4px;
z-index: 10; /*important*/
color: rgba(255,255,255,.9);
list-style-type: none; /*remove the bullet*/
}
Thanks for any suggestions.
from Recent Questions - Stack Overflow https://ift.tt/3stKZJ7
https://ift.tt/38N2L2a
Comments
Post a Comment