Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Links inside Sidebar after click have no active color #83

Closed
4 tasks done
einazare opened this issue Feb 14, 2019 · 11 comments
Closed
4 tasks done

Links inside Sidebar after click have no active color #83

einazare opened this issue Feb 14, 2019 · 11 comments
Labels

Comments

@einazare
Copy link
Contributor

Prerequisites

Please answer the following questions for yourself before submitting an issue.

  • I am running the latest version
  • I checked the documentation and found no answer
  • I checked to make sure that this issue has not already been filed
  • I'm reporting the issue to the correct repository (for multi-repository projects)

Expected Behavior

The links should have the active colors set from the Right Menu (FixedPlugin) after pressing one of them.

Current Behavior

When clicking the links in the Left Menu (Sidebar) component, the active color disappears.

Failure Information (for bugs)

This happens due to the focus css prop.

Steps to Reproduce

Please provide detailed steps for reproducing the issue.

  1. Go on the live preview: https://demos.creative-tim.com/material-dashboard-react/#/admin/dashboard
  2. Click on any of the links inside the Left Menu (Sidebar component)
  3. Without any further clicking, or defocusing from the clicked link, move the cursor away
  4. Notice how the link remains with no background color

Context

Unrelevant

Failure Logs

This happens due to the focus css prop.

Solution

  1. Go inside src/assets/jss/material-dashboard-react/components/sidebarStyle.jsx
  2. Change lines 191, 206, 228, 250 and 272 from "&:hover": { to "&:hover,&:focus": {

Best,
Manu

@gkarapeev
Copy link

@einazare thanks for the solution - it was bothering me so much but I didn't have the skill to pinpoint it! You're a star!

@Samriddhi25
Copy link

@einazare when I switch from one page to another, I had to re-load the page to see the content on the webpage otherwise is it not showing up can you please tell me why am I facing this issue.

@einazare
Copy link
Contributor Author

Hello there @Samriddhi25 ,

Can you please share with me your code inside index.js?

Best,
Manu

@Samriddhi25
Copy link

Samriddhi25 commented Jun 16, 2020

<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
<link rel="shortcut icon" href="%PUBLIC_URL%/favicon.ico" />
<link
  rel="apple-touch-icon"
  sizes="76x76"
  href="%PUBLIC_URL%/apple-icon.png"
/>
<link
  rel="stylesheet"
  href="//cdn.jsdelivr.net/chartist.js/latest/chartist.min.css"
/>

<script src="//cdn.jsdelivr.net/chartist.js/latest/chartist.min.js" ></script>
<link
  rel="stylesheet"
  href="https://fonts.googleapis.com/css?family=Roboto:300,400,500,700|Material+Icons"
/>
<link
  href="https://fonts.googleapis.com/icon?family=Material+Icons"
  rel="stylesheet"
/>
<link
  rel="stylesheet"
  href="//maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css"
/>
<title>Material Dashboard React by Creative Tim</title>

@einazare I have not altered the code at all

@einazare
Copy link
Contributor Author

Hello again, @Samriddhi25 ,

That is the index.html not the index.js file.

Best,
Manu

@Samriddhi25
Copy link

Samriddhi25 commented Jun 16, 2020

@einazare I misinterpreted it, here is the index,js

import React from "react";
import ReactDOM from "react-dom";
import { createBrowserHistory } from "history";
import { Router, Route, Switch, Redirect } from "react-router-dom";

// core components
import Admin from "layouts/Admin.js";
import RTL from "layouts/RTL.js";

import "assets/css/material-dashboard-react.css?v=1.9.0";

const hist = createBrowserHistory();

ReactDOM.render(
Router history={hist}
Switch
Route path="/admin" component={Admin}
Route path="/rtl" component={RTL}
Redirect from="/" to="/admin/dashboard"
Switch
Router>
document.getElementById("root")
);

I have deliberately removed the angular brackets as the content inside it was not appearing.

@einazare
Copy link
Contributor Author

Hello again, @Samriddhi25 ,

Please send the code in code format to show you the changes you need to make.

@Samriddhi25
Copy link

import React from "react";
import ReactDOM from "react-dom";
import { createBrowserHistory } from "history";
import { Router, Route, Switch, Redirect } from "react-router-dom";

// core components
import Admin from "layouts/Admin.js";
import RTL from "layouts/RTL.js";

import "assets/css/material-dashboard-react.css?v=1.9.0";

const hist = createBrowserHistory();

ReactDOM.render(
  <Router history={hist}>
    <Switch>
      <Route path="/admin" component={Admin} />
      <Route path="/rtl" component={RTL} />
      <Redirect from="/" to="/admin/dashboard" />
    </Switch>
  </Router>,
  document.getElementById("root")
);

@einazare

@einazare
Copy link
Contributor Author

Please try this code:

import React from "react";
import ReactDOM from "react-dom";
import { BrowserRouter, Route, Switch, Redirect } from "react-router-dom";

// core components
import Admin from "layouts/Admin.js";
import RTL from "layouts/RTL.js";

import "assets/css/material-dashboard-react.css?v=1.9.0";

ReactDOM.render(
  <BrowserRouter>
    <Switch>
      <Route path="/admin" component={Admin} />
      <Route path="/rtl" component={RTL} />
      <Redirect from="/" to="/admin/dashboard" />
    </Switch>
  </BrowserRouter>,
  document.getElementById("root")
);

I've seen recently that sometimes, the combination of history & react-router-dom fails.

@Samriddhi25
Copy link

Thanks a lot @einazare it worked!

@Fuadissa
Copy link

Thanks it fix my issues.
Am really grateful 🥰🥲🥲

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants