Relatived positioned children with column-fill parent - css

I wanted to create a layout where when the divs reach the bottom they will continue from the top. See my (super fancy) image I drew:
I got it working by using column-fill: auto. And now I'd like to add a dimmer on each item when being clicked. I'm using React and Semantic UI React for my app so I'm trying to achieve this with their Dimmer component.
My problem is that when I active the dimmer, it's not "dimmering" the whole item. I made a small CodeSandbox for my problem so we can debug this more easily. When you press the third item you can see that the part who is coming from the top is not dimmed. I assume it because the position of the dimmer is relative.
LINK: https://codesandbox.io/s/semantic-ui-react-yl0dj
I hope I described my issue well enough and that we can solve this together.
Cheers!

Related

Accordions in a Grid pushing content down

I have a grid of accordions like in the codesandbox below. The problem is when I open one of the accordions, it pushes down all the accordions in the row below, whereas the desired behaviour is to just push down the accordion right below it and the other accordions in the lower row staying in the same place. What needs to be changed in the following code to get this effect?
https://codesandbox.io/s/basicaccordion-demo-material-ui-forked-sw4juk?file=/demo.tsx
You can utilize the power of the Grid component to get your desired behavior. Nesting grids within grids is the magic sauce:
To do this with the material Grid component, the layout will need to be as such:
EXAMPLE (I forked your sandbox)

How to get rid of useless scrollbars in a material dialog when a radio-group is used?

This Stackblitz example opens a simple dialog which contains a radio group in the mat-dialog-content div.
You can see that the dialog-content shows an ugly scrollbar:
This does not happen when other components are used: e.g. input, etc.
Using chrome dev-tools, I can see that the mat-radio-buttons have a height of 20px:
but the mat-radio-group only has a height of 17px:
Is this a bug in angular material components (the example uses version 12.0.4), or is there a simple workaround/css that we can use to get rid of the scrollbar?
I've tried explicitly setting the height on the mat-radio-group, but this has no effect.
Notes:
in production we do of course have many dialogs and some of them are large and need the scrollbars
we need an application wide solution/workaround
simply hiding the scrollbars is not okay: it must remain auto so that the dialog can react to size changes (e.g. user rotates device, some items are shown/hidden dynamically, etc.
For now we came up with a workaround that fixes the issue in all our 30+ dialogs.
The nice thing is that we can apply it in one place, in styles.scss:
.mat-dialog-content {
padding-bottom: 10px !important;
}
We just add a padding to the bottom of the dialog content area and then scrollbars: auto works as expected in all our dialogs (small and large). i.e. when you make the browser window larger/smaller, the scrollbar is automatically shown/hidden.
And it also works when there are multiple mat-radio-groups in one dialog.
The additional padding between the content and bottom dialog-actions is acceptable for our ui.
Stackblitz example with workaround
The reason this happens is due to the ripple effect on the radio button - which takes up additional space and causes the scrollbar to show. See https://github.com/angular/components/issues/20344
There are a number of ways to resolve this, such as using padding or margins on the components or on the dialog content itself like you did. The important thing is that there is enough space added to accommodate the ripple.

After scrolling down component, how to set 'position:fixed' without reverting the component back to its original position?

I have a component sidebar which the user can scroll down. If the user clicks a button (external to the component) I use [ngClass] to add position:fixed to sidebar, and sidebar returns to its' original position. How can I prevent scrolling on sidebar without returning sidebar to its' origin position?
Edit: It was recommended that I provide code to explain my problem, so I created a stackblitz here.
The main pieces of the stackblitz example are the app.component, and the sidebar.component. To see my problem, scroll down on the sidebar, then click the stopScroll button, and see how the sidebar is moved back to its' original spot.
This is possible without any crazy scripting, but it requires you specify a fixed size for the container. By changing the overflow property of the container, we can "lock" the scroll to a specific spot.
Take a look at this StackBlitz

Nativescript: How to overlay one StackLayout over another StackLayout

I have a search suggestion component that is displayed under a TextField. whenever text is entered into the TextField the search suggestion component displays a list of possible matches based on the current entered text... I have more content under the TextField that gets pushed to the bottom whenever the Search suggestion gets populated with results. Is there any way to overlay the search suggestions over the content underneath it instead of pushing the content down? in HTML/css I would apply the position absolute and z-index css properties to the search suggestion component but this doesn't seem to be the case in Nativescript. I see that Nativescript does support the z-index css property but just applying that doesn't seem to do anything. It doesn't look like Nativescript supports the position property... Any idea how I can make this work/what i'm missing?
You have a couple quick options. One is to use a grid as mentioned in the comments. Set the views on the same row/col. This is the same as stacking views on the z axis. Or an absolute layout and use the same positioning of the views within that layout.

z-index when nesting custom elements seems to get a new stacking context. Why?

I have a dialog box in my application which displays a list of cards. I made a jsbin simplified version of it
http://jsbin.com/qopocej/edit?html,output
If I click on the blue outline on any of the cards a nice dialog box pops up with a short menu item in it. Particularly click on the blue outline below 'Joe' and see how the dialog box covers the current card and those surrounding it.
I need to refactor the code so that this current element in each card action is a new custom element, which brings with it all the functionality of displaying the menu dialog box. In the real application this does some ajax calls to the serve to update information.
The problem I have is that the very fact of refactoring has destroyed the way the dialog box displays. This is shown is this jsbin
http://jsbin.com/vecoxuh/edit?html,output
Click on the red box under 'Joe' and see how the dialog box is above the current card, but slips under the other cards nearby
I assume it is something to do with "stacking context", since the explicit styles that has added a z-index to each of the two dialog boxes should imply it still works, but it doesn't
The .item with an active dialog needs to be set a z-index that's higher than its siblings. The child dropdown menu's z-index is relative to that of its parents, no matter what it's explicitly set to. So if the furthermost parent does not have a z-index that enables it to overlap the other cards, none of its children will be able to do the same.

Resources