ReactJS Application: Issue with Selective Mobile Scrolling

I've been working on a ReactJS web app where we mainly use styled-components for styling, but also sometimes utilize index.css for global styles (such as body and html).

The application consists of an app header, a page header, and a container with additional components.

Recently, I've encountered a strange issue where certain mobile devices, specifically the Sony Xperia XCompact and the Samsung S8, are unable to scroll down.

Here are snippets from the .js files: (The components are spread across multiple files, so I've tried to include everything that may be relevant.)

// app.js
const AppHeader = styled.div`
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr;
  height: 100px;
`;

const PageHeaderContainer = styled.div`
  display: grid;
  grid-template-rows: auto auto;
  padding-bottom: 0px;
  padding-top: 10px;
`;

const Container = styled.div`
    max-width: 414px;
    height: 100%;
`

export default = () => ( 
<AppHeader/>
<PageHeaderContainer>
    <Greeting/>
    <PageTitle/>
</PageHeaderContainer>
<IntroductionSlider>
    <Container>
        {/*more components*/}
    </Container>
</IntroductionSlider>
)

These issues can't seem to be resolved by the index.css file:

html, body{
    overflow-x: hidden;
    border: none;
    outline: none;
    overflow-x: hidden;
    overflow-y: scroll;
    scrollbar-width: none;
    scroll-behavior: smooth !important;
    position: absolute;
    margin: 0;
    padding: 0;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
}

body {
    margin: 0;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-align: center;
    width: 100%;
    height: 100%;
}

Although this code works perfectly in Chrome, Opera, and other mobile browsers like Pixel 2, S10, Pixel 3, and iPhone 7, the scrolling function is somehow disabled on Sony Xperia XCompact and Samsung S8+.

As a temporary solution, changing the height of body to auto instead of 100% re-enables scrolling (tested on the Sony phone). However, the root cause of this problem still eludes me.

Since much of this codebase was inherited, I'm still relatively new at this job and trying to grasp how things work. Any insights or assistance would be immensely appreciated!

Answer №1

There was a known issue in the previous version of Mobile Chrome which has since been rectified. Either implement the following fix or patiently await the next update.

max-width: calc(100% - 1px);

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

Having trouble with AngularJS not sending form values properly?

I have a code snippet in my app.js file where I am trying to pass the value of email to a file named handler.php. $scope.doForget={email:''}; $scope.doForget = function (customer) { //email = $scope.forget.email; For Testing i am hardcoding ...

Is there a way to stack multiple Divs on top of each other using Float instead of relying on absolute positioning?

I've decided to revamp my approach and transition from using absolute positions to utilizing floats for positioning elements the way I desire. Now the challenge lies in figuring out how to float multiple divs on top of each other, allowing users to s ...

What is the method for altering the background color of an input field upon entering text?

As a beginner in Javascript and jQuery, I am struggling to understand why my code is behaving the way it does. I have written two similar functions aimed at changing the background color of an input field. The objective is to set the background color of t ...

Best approach for retrieving and adding a large number of images when dealing with slower connections

Currently, I am retrieving 100-200 images using a combination of ajax-php-mongodb. The process involves ajax making an initial call with parameters, php on the server side locating the appropriate mongo document containing all image file ids in grid fs, fe ...

Struggling to incorporate blocks into Jade for Express. Encountering errors like "Max Stack Size Exceeded" and issues with setHeader

I am currently using Express along with a simple express-generator server that I created. My first task was to focus on creating the view layout and extending the index page, but unfortunately, I have encountered some challenges. Throughout my process, I& ...

Execute index.js code from index.html using NodeJS and Express

Currently, I am diving into the world of NodeJS and Express using Replit.com for a small project. The main objective is to develop a basic input field that, upon submission, will post to different channels such as Discord and Twitter. The piece of code be ...

The most efficient and hygienic method for retrieving a value based on an observable

Looking at the structure of my code, I see that there are numerous Observables and ReplaySubjects. When trying to extract a value from one of these observables in the HTML template, what would be the most effective approach? In certain situations, parame ...

Encountering issues with the React component navbar on the live server

Just diving into the world of React and attempting to incorporate a Navbar or another component using React-bootstrap 5. However, when I run npm start, nothing appears on the live server. I have attached screenshots in the provided link for reference. Ev ...

Highlighting DOM elements that have recently been modified in Angular

Is there a simple way to change the style of an element when a bound property value changes, without storing a dedicated property in the component? The elements I want to highlight are input form elements: <tr field label="Lieu dépôt"> ...

Managing dynamic backend ports while using axios in React.js- a comprehensive guide!

This morning, I successfully deployed a login app using the MERN stack on Heroku. However, when attempting to log in GET http://localhost:5000/user/login/email/password net::ERR_CONNECTION_REFUSED appeared in the console. I realized that the error w ...

Can I programmatically retrieve a comprehensive list of all global HTML attributes available?

Exploring the extensive list of global HTML attributes can be overwhelming, especially when considering how it continues to evolve with browser updates. Can JavaScript be leveraged to dynamically generate a complete list of these attributes without the ne ...

When the user presses the enter key to submit data, the Ajax page reloads

I am facing an issue with a simple form for sending messages from one person to another using AJAX method POST to prevent page reload. The problem arises when the user hits [ENTER] in the field, causing the page to reload instead of the AJAX working as int ...

What is the best way to utilize the oninput function in Jade?

input(type='range', id= 'inputSlider', min='0', max='255', value='50', step='1', oninput=showValue(this.value)) span#outputText 50 script. var socket = io.connect(); socket.on(& ...

The JSON array retrieved from the $http.GET request is coming back as undefined, which is not expected

Presenting my code below: function gatherDataForGraph(unit, startTs, endTs, startState, endState){ points = []; console.log('/file/tsDataPoints/'+unit+"?startDate="+startTs+"&endDate="+endTs+"&startState="+startState+"&endState="+en ...

When I click on a tab section to expand it, the carat arrows all point upwards. Only the arrows corresponding to the selected section should

click here for imageIt appears that there are four tabs, each with a click function on the carat icon. When I expand one tab, all carats point upwards instead of only the selected one appearing. accountSelection(account) { if (!this.selectedAccoun ...

Wrapper Div at the Center

I'm currently working on aligning my webpage in the center using the following CSS: .wrapper { display: flex; align-items: stretch; background: #fafafa; /*max-width: 1520px; */ box-shadow: 1px 1px 12px rgba(0, 0, 0, 0.1); text ...

Sharing node_modules via Npm and ensuring the package.json is correctly mapped

I have a dilemma with two projects, one serving as a server and the other as a client. They share very similar dependencies, making it tedious to set up shared dependencies without manual file editing or installing everything twice. The issue is exacerbate ...

Encountered SyntaxError: An unexpected token has been found while integrating leaflet with flask

Despite adding all necessary scripts and configuring my API_KEY in config.js, I keep getting an error message saying "Uncaught SyntaxError: Unexpected token." I have double-checked my API key multiple times, and it seems to be correct. Here is a snippet f ...

Rendering a page for a missing resource

Within the App.js file, the routes component is currently only wrapping a portion of the website. However, I would like the NotFound component to be rendered for the entire page if an incorrect URL is entered. Can you please provide guidance on how this ...

When applying the spread syntax to add data to the React state, the initial select element fails to reflect the changes made in the selected

Currently, I am developing my frontend using React. My goal is to have the selected bank added to the selectData state when a user chooses it. However, I am facing an issue where the bank is not being added to the selectedData state upon the first select ...