`position: absolute` issue

Hey guys! Having a really weird position absolute issue. Parent .fg-btn-wrapper has position: relative on it. Child .fg-btn has position: absolute on it with top: 0, right: 0. Instead of it being to the right of the container inside of it, it's outside of it to the left. This is unfortunately behind authentication so I can't show a live link but I have no idea why it's doing this. Just looking for ideas
No description
No description
No description
53 Replies
vince
vinceOP3mo ago
Ohhh works on Chrome but not Firefox... what
ἔρως
ἔρως3mo ago
why the transform?
vince
vinceOP3mo ago
So it goes underneath the tab panel, but toggling that doesn't affect it
knighty
knighty3mo ago
that 100% is based off the element size, not the container so it'll break when you add more items you want top:100% as for the horizontal issue hard to say without seeing more code/dom
vince
vinceOP3mo ago
It's a bit hacky but what we want is for the button to go underneath the tabs - I'd place it like that in the DOM but that would require us to put it on every tab panel (and this is added via a CMS not HTML so it's tricky to do that, hence positioning it) -- the transform works correctly but not the position
vince
vinceOP3mo ago
On Chrome it works as expected
No description
ἔρως
ἔρως3mo ago
what's working as expected?
vince
vinceOP3mo ago
That the button is positioned to the right of the container and inside of it
knighty
knighty3mo ago
oh i assumed this was some kind of dropdown my bad
ἔρως
ἔρως3mo ago
without context, it's just bad assumptions
vince
vinceOP3mo ago
On Firefox it's outside of its container and to the left
No description
knighty
knighty3mo ago
whatever your container is presumably has 0 width in firefox hence why right:0 is aligning it to the left
vince
vinceOP3mo ago
No worries, hard to show without a live example 😄
ἔρως
ἔρως3mo ago
i bet it is a float
knighty
knighty3mo ago
yeah could be something like that
ἔρως
ἔρως3mo ago
floats without a clear cause this issue
vince
vinceOP3mo ago
Hmm let me see thank you for the idea guys 🙂
knighty
knighty3mo ago
i'd remove every bit of styling you can and just add your button as a child of a div right below the tab bar with position:relative and nothing else
vince
vinceOP3mo ago
Unfortunately not that easy when we're building enterprise web applications via a CMS 😂
ἔρως
ἔρως3mo ago
not easy at all
vince
vinceOP3mo ago
But it's a good shout, all the styling there is default styling. It seems in Firefox when I untick the default display, it'll snap into place correctlyy
knighty
knighty3mo ago
the display:unset?
vince
vinceOP3mo ago
Even though the default display is inherit
knighty
knighty3mo ago
i have no idea why that is there
ἔρως
ἔρως3mo ago
the default of a div is block
vince
vinceOP3mo ago
Sorry no, this:
No description
ἔρως
ἔρως3mo ago
it's there to override the grid angular?
vince
vinceOP3mo ago
I've tried manually setting display which is why you see display: unset I think that's what it's built on under the hood yea, but the way we add elements is all done via the CMS and everything is wired by someone else So that 'Add' button has all this logic wired to it and I don't know how to move it around Otherwise I'd move it inside each tab panel and be done with it rather than absoluting it
ἔρως
ἔρως3mo ago
how about grid? you can set a grid like auto 1fr, with 1fr auto for the rows
vince
vinceOP3mo ago
I tried that too - it seems whenever I untick the .form-field-type-field-group display it'll snap into place correctly but not if I set it manually 🙁 Oh you mean make the whole container a grid?
ἔρως
ἔρως3mo ago
yes or just the 2nd row
vince
vinceOP3mo ago
Hmmm maybe if I have no other options haha I'd have to make the whole container a grid and there's a lot of elements inside of it
knighty
knighty3mo ago
do you have control of the whole div that the button is in, that whole row i mean with the whitespace to the left of it
vince
vinceOP3mo ago
The 'Add' button? Oh I see
vince
vinceOP3mo ago
Yea the button is what I'm position: absoluting so it's not really so much in a div just absolute-d It's not like it's in a div itself and I can display: grid, place-items: end
knighty
knighty3mo ago
yeah but then why isn't this just
<div>
<button style="margin-left: auto">Add</button>
</div>
<div>
<button style="margin-left: auto">Add</button>
</div>
am i missing something
vince
vinceOP3mo ago
It's hard to show without a live page haha
knighty
knighty3mo ago
so then you dont control the area it sounds like to me, thats why im a bit confused if you could write a really short bit of dom markup with the relevent nodes it might help
vince
vinceOP3mo ago
Okay I see what you're saying. So this is how it is by default:
No description
knighty
knighty3mo ago
oooh so your thing is ABOVE the toolbar and youre manually forcing it down below
vince
vinceOP3mo ago
But the issue is this:
No description
vince
vinceOP3mo ago
Yes! I tried placing the button in between in the CMS but it doesn't work 🙁
knighty
knighty3mo ago
so wait, you can put it between?
vince
vinceOP3mo ago
I tried it but let me try it again
knighty
knighty3mo ago
as in <tabs><your thing><textarea>?
vince
vinceOP3mo ago
Okay thank you a ton guys for walking through this with me So I tried placing it in between before but it wasn't working, I decided to try it inside the tab panel and it works I thought it was going to be a lot harder, but I think I can just duplicate the button for each tab
knighty
knighty3mo ago
whatever works lol so you want an add button for each tab? and by that do you mean it just shows 1 button for each tab when you change between tabs
vince
vinceOP3mo ago
😂 yea I think that'll be easiest, yea it'll just have the same 'Add' button for each tab It just adds a row to the table
knighty
knighty3mo ago
oh right that big blocked out area is a table i assumed it was just a text area
vince
vinceOP3mo ago
Nah sorry I'd post it but it's got sensitive data 😨 It's a dashboard for an insurance company
knighty
knighty3mo ago
yeah i get it just didnt realise at first lol oof my condolences... make sure you get some insurance for when you want to hurt yourself after working in insurance
vince
vinceOP3mo ago
fr 😭

Did you find this page helpful?