Is there a way to eliminate the outline on a FormControl component in React-bootstrap when the input field is selected?

Currently, I'm working on creating a search bar with dropdown suggestions using React-bootstrap. My goal is to have the search bar span across the page from one side to another with margins on the left and right. To achieve this, I am enclosing the input field within a < Container > element. However, I am facing an issue with styling where I want to remove the default blue outline that appears when the input field is highlighted. Despite trying various solutions, I haven't been successful in getting rid of it. Even inspecting the applied CSS through the browser didn't provide any insights.

Additionally, the search bar is set to display only upon clicking the search button. I am not sure if this detail affects the solution. Below is the code snippet where I attempted to address the styling issue:

<div className="search-dropdown">
  <Container>
    {showSearch && (
    <Form inline>
      <FormControl
        type="text"
        placeholder="Search for a Product"
      />
    </Form>
    )}
  </Container>
</div>
.search-dropdown{
  width: 100%;
  border: 1px solid black;
  z-index: 9999;
  position: fixed;
}

.search-dropdown input {
  border: none !important;
  outline: none !important;
}
/* This rule is repeated just to ensure focus behavior */
.search-dropdown input:focus {
  outline: none !important;
}

Answer №1

Bootstrap applies box-shadow to focus input as an outline. To disable the box shadow, simply add box-shadow: none; to the input.

To implement this, you can use the following CSS:

.search-dropdown .form-control:focus{
  box-shadow: none;
}

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

What is the best way to extract and display data from an API response object in my

{ "_metadata": { "uid": "someuid" }, "reference": [ { "locale": "en-us", ... bunch of similar key:value "close_icon_size" ...

NextJs experiencing hydration issue due to a basic array.map operation

Having an odd hydration issue while working with NextJS. I could use some assistance figuring out what's causing it. I have an object that is being processed synchronously. When I stringify this object and render it, everything works fine without any ...

Having difficulty retrieving a dropdown value with reactjs

Seeking assistance with retrieving dropdown values in ReactJS. Despite attempting multiple methods, I have been unsuccessful in obtaining the values. Can someone provide guidance on extracting these values? Below is a snippet of my code: <Grid container ...

The automated Login Pop Up button appears on its own and does not immediately redirect to the login form

Hey guys, I'm struggling with modifying the jquery and html to ensure that when the login button is clicked, the login form pops up instead of displaying another login button. Another issue I am facing is that the login button seems to pop up automati ...

Automatic Addition of Row Numbers Enabled

I'm currently exploring coding and experimenting with creating a scorekeeper for family games. I've managed to add rows dynamically and automatically sum up the entered information in the "total" row at the bottom. However, I'm facing an iss ...

Tips for preventing constructor from being called when the route changes?

Currently, I am developing an app that incorporates webSockets (socket.io). The Layout component contains the initialization of the webSocket connection in the constructor: export default class Layout extends Component { constructor(props) { super ...

Adjusting table font dynamically using Angular and CSS

I am currently working on an Angular project and facing a challenge with setting the font size dynamically in a table. I have created a function to address this issue, which includes the following code snippet: $('.td').css({ 'font-size ...

Using Next JS to create a Checkbox that selects all options

As a newcomer to Next Js, I am currently attempting to incorporate a select all feature for checkboxes. I came across this resource that I have been following: https://www.freecodecamp.org/news/how-to-work-with-multiple-checkboxes-in-react/ My goal is to ...

Oops! The PNG file you're trying to use hasn't been compiled yet. Remember to compile it into a .flat file

Trying to generate a signed APK in react-native by following their guidelines, but encountering an error when running the ./gradlew assembleRelease command. The specific error details can be found here. Details of my platform: Operating System: Windows ...

Find the string "s" within a div element aligned vertically, using Popper

Currently utilizing Popper from Material-UI <Popper id={"simplePopper"} open={true} style={{backgroundColor: 'red',opacity:'0.5',width:'100%',height:'100%'}}> <div style={{height:"100%", ...

Develop an innovative showcase page showcasing 151 individual profiles with React Router

I am new to using React Router and feeling a bit confused about how to proceed. On my homepage, I have 151 unique monster thumbnails. When a user clicks on a thumbnail, they should be directed to the specific monster's 'show page'. Currently ...

Disable the border and background colors in CloudFlare Turnstile

I have implemented the CloudFlare reCaptcha Turnstile and I am looking to modify the widget by removing the border and background color. I believe this customization can be achieved using CSS or Javascript. Thank you for any assistance! ...

React JS: Incorporating Multiple Placeholder Objects within Components

Apologies if this question is a duplicate, but I haven't found any helpful answers yet. I'm new to React and JavaScript. I am looking to include multiple objects inside a component: For example: src={url} name={text} subTitle={subtext} My in ...

Is there a way to adjust the width of my web layout without sacrificing its responsiveness?

Struggling with my website layout design as I encountered an issue. The overall width of the layout is too excessive, and I want to introduce some margins on the sides for a better visual appeal. Although the responsive design works well originally, adding ...

Ensuring Bootstrap 3 Table Header Widths Remain Fixed

How can I ensure the header columns in my Bootstrap 3 table maintain a fixed width, regardless of the content in the regular rows? I want to avoid the messy look of content splitting onto multiple lines. Here's an example: I'd prefer not to adju ...

Tips for maintaining an active link using CSS

I am looking to create a hover effect for links that remains active when the user is on a specific page. Essentially, I want a background to appear behind the link when it is visited. Below is the HTML code: <div class="menudiv"> <div id="menu"& ...

Stepping Up: Implementing Progress Bars in Material-UI Step-by-Step

Currently, I am working on a Stepper and I am looking to incorporate a progress bar between each step. I am utilizing Material-ui Stepper connector for this purpose, however, the same connector is being applied to all steps. While this can be resolved usin ...

Encountered 'Exceeded Maximum Call Stack Size' error with dotenv-expand while running React on CircleCI

I'm currently facing an error while attempting to build a react app on CircleCI. This issue has recently surfaced whenever I run the command npm run build in my circle.yml file: #!/bin/bash -eo pipefail npm run build > <a href="/cdn-cgi/l/ ...

In order to maintain a custom tooltip in an open state until it is hovered over, while also controlling its

When hovering over the first column of the table, a tooltip will appear. Within each material tooltip, I would like to include a button at the bottom right after the JSON data. When this button is clicked, it should open an Angular Material dialog. <ng ...

Best practices for annotating component props that can receive either a Component or a string representing an HTML tag

What is the correct way to annotate component props that can accept either a Component or a string representing an HTML tag? For instance, imagine I have a component that can receive a custom Component (which includes HTML tags like div, p, etc.). The cod ...