PlasmoCSUI's setting of h-full does not have the ability to completely fill the parent

Issue with PlasmoCSUI h-full not functioning properly

I'm having trouble getting my custom button to align correctly with a row of buttons on Twitter. Despite using the h-full attribute, my element isn't filling the parent node as expected. Has anyone encountered this issue before?

Refer to the code snippet below:

import cssText from "data-text:~style.css"
import type { PlasmoCSConfig, PlasmoGetInlineAnchorList } from "plasmo"

export const getStyle = () => {
    const style = document.createElement("style")
    style.textContent = cssText.replaceAll(":root", ":host")
    return style
}
export const config: PlasmoCSConfig = {
    matches: ["*://*.x.com/*", "*://*.twitter.com/*"]
}

export const getInlineAnchorList: PlasmoGetInlineAnchorList = async () => {
    const elements = document.querySelectorAll('[role="tablist"]:last-child')
    return Array.from(elements).map((el) => ({
        element: el,
        insertPosition: "beforeend"
    }))
}

const PlasmoCSUI = () => {
    return (
        <div className="my-auto flex items-center justify-center" style={{ height: 'var(--twitter-tab-height)' }}>
            <div className="my-auto w-9 h-full flex items-center justify-center ml-1 bg-red-500">
                tag
            </div>
        </div>
    )
}

export default PlasmoCSUI

Answer №1

Utilizing the shadow DOM, this system creates dual div container layers automatically. By inspecting the web browser, I identified the two distinct node IDs and modified the style.css file to include height: 100% for both elements:

#plasmo-shadow-container {
    height: 100%;
}

#plasmo-inline {
    height: 100%;
}

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Securing PHP Sessions with Unique Keys

Having some trouble with implementing PHP login and user validation once they access the system. While I have a basic understanding, I'm uncertain if my approach is correct. Let me walk you through it step by step. Firstly, there's a form for i ...

What is the best way to retrieve the attribute value of the parent tag within a function?

Below is the html structure in question: <script> function process(){ //how to get attribute window.allert(attr); } </script> <div attr="234234"> <div onclick="process()">some content</div> </d ...

Can Phonegap be utilized to port a PlayN game to iOS?

PlayN seems like a fantastic tool for creating Html5 games. I'm curious to know if there are any plans to ensure that the html/javascript output is compatible with Phonegap, ultimately allowing for the creation of an iOS executable? ...

Utilizing Jquery to Load JSON Arrays as Tooltip Messages

I have successfully loaded the descriptions of my JSON variable into my script as tooltips. However, I am encountering two issues: When hovering over one sentence in my table, tooltips for all four sentences appear. It seems like I am unable to revert my ...

What is the best way to direct a user's input in HTML with a specified format?

I'm looking for a way to create a user-friendly input format for a timestamp in the form of HH:MM. I want the input field to display "__:__" initially, and as the user enters numbers, they should replace the underscores. When they reach the colon, the ...

Calculation of Fields in React Hook Form

My form includes the following fields: 1-Charge Amount Default Value =120 2-Charge Count Default Value=1 3-Total Amount =Charge Amount * Charge Count 4-Paid Amount 5-Balance =Total Amount - Paid Amount To view my code, visit: https://codesandbox ...

Navigational tabs arranged vertically with the ability to scroll

I'm struggling with making the code below (from bootstrap v4) scrollable. I want to treat the v-pills-tab as a child of a container that has a set height and a maximum height of 100%: <div class="nav flex-column nav-pills" id="v-pills-tab" role="t ...

Combining a left vertical navigation bar with a top navigation bar in Bootstrap 4

I am currently working on creating an admin UI using bootstrap 4 that includes two menus, one vertical and the other at the top bar. My goal is to have a navigation layout similar to this: https://i.sstatic.net/q2NbY.png Here is the snippet of my HTML co ...

Having problems with running `npm start` due to compatibility issues with react-scripts version 3

I've come across a recurring issue with running npm start in my React project and I can't seem to find a solution. Every time I run the command, I encounter the same logs as shown below. The common fix suggested is to uninstall node_modules and r ...

Is there a way to convert the existing JavaScript code for a hyperlink so that it can be triggered by clicking a button instead?

I have a JavaScript code that works well when the hyperlink below is clicked: <a href="delete_event.php?event_id=110" onClick="return ConfirmDelete()" class="list-group-item">Delete Event</a> <script> function ConfirmDelete() { var ans ...

Tips for sending two values to a PHP file using JavaScript Ajax

I have created a code for two dropdown menus. The goal is to select values from both menus and send them to a php file using the GET method. The values should be sent to the php file only when both menus have selections made. Below is the code snippet: ...

A step-by-step guide to thoroughly examining the form status in a React application, allowing for the activation of a previously disabled submit button

When I have an onChange event in React, the state is populated correctly. I disable the form button when a field is empty on submit, but I also want users to be able to go back and fill out those fields. The key issue is that if both fields have data, I wa ...

How to align a div in the center of a cell with Bootstrap

I am currently working with Bootstrap 3 and I have a specific requirement to center a div within a cell in the container row. Most resources I found only mention how to center a div within the entire container, which is not what I am looking for. My goal i ...

What are the best strategies to perfectly insert an image within a div, ensuring that no background color is visible?

Is there a way to fix the issue of a white background appearing at the bottom of this div? .flexbox-item_one { display: inline-block; width: 200px; margin: 10px; background-color: white; box-shadow: 5px 5px 5px; overflow: hidden; } .flexb ...

Having trouble with React? The link to the component refuses to load until the page is manually

React Component Link Not Loading Without Page Refresh I'm facing an issue where the link to the terms and conditions won't load unless I refresh the page. You can watch the video below for more context. https://youtu.be/2QumWBRXiuM Below is the ...

Issues with Bootstrap's hamburger menu not functioning properly when clicked

Can't seem to get my hamburger button working. I've followed the bootstrap documentation and ensured that Bootstrap and jQuery are in the correct order, but still no luck. Any suggestions on what could be causing this issue? Are my links misplace ...

When utilizing customize-cra to modify antd less variables, it results in the generation of numerous redundant CSS files during the build

While utilizing customize-cra to override antd less variable, I have encountered an issue where it generates multiple duplicate CSS files during the build process. According to the documentation provided by antd, if I opt for the default import of CSS by ...

Tips for maintaining three image sliders in a single row in WordPress

Having three short codes displayed on my page, I am struggling to keep them on the same line. Is there a straightforward method to control the images, placing three per line? I have a CSS plugin that allows me to use DIV tags to assign a DIV for alignmen ...

Adjusting the spacing between dropdown menu items in Bootstrap sass with Rails

After adding the bootstrap-sass gem to my app, I have implemented two dropdown menus on the right side of the screen. Although they are horizontally aligned, I find that they are too close to each other. I would like to create some space between them and ...

Difficulty aligning Material2 icons and title text in CSS styling

I'm encountering a design problem when incorporating material2 icons into my Angular application. Specifically, I have a button that displays both a material2 icon and some text side by side from left to right. Currently, the icons are centered within ...