Troubleshooting Vue.js rendering problems on Safari_BROWSER

I'm encountering a strange issue with my portfolio website, which is built using Vue and Laravel. The problem arises specifically in Safari - the project thumbnails don't display until the browser window is resized. Here's the relevant code snippet:

  <div class="project-list">
        <img v-show="!loaded" class="loading" src="../assets/contrast_load.gif" alt="loading...">
          <div class="project-container" v-for="project in shownProjects.slice().reverse()" v-bind:key="project.id">
            <figure class="project" @mouseover="gColor1 = project.color1; gColor2 = project.color2" @click="goToPage(project.id)" :style="`--overlay-color: ${project.color1};`">
              <img :src="`${base}/storage/app/${project.thumb_img}`" :alt="project.name" />
              <figcaption>
                <h3>{{ project.name }} <span v-bind:style="{color: project.color1}">{{ project.description }}</span></h3>
              </figcaption>
            </figure>
          </div>
      </div>
    </div>
  </div>
</template>

<script>
import LogoSVG from '../components/LogoSVG.vue';
import config from '../config';
import axios from 'axios';
export default {
  name: 'Portfolio',
  data(){
    return{
      search: '',
      projects: [],
      shownProjects: [],
      loaded: false,
      gColor1: '#752323',
      gColor2: '#e04747',
      base: config.BASE_URL,
    }
  },
  components:{
    LogoSVG,
  },
  watch:{
    search(){
      const vm = this;
      vm.shownProjects = [];
      if (vm.search == '') {
        vm.shownProjects = vm.projects;
      }
      else {
        for (var i = 0; i < vm.projects.length; i++) {
          if(vm.projects[i].tags.toLowerCase().search(vm.search.toLowerCase()) > -1){
            vm.shownProjects.push(vm.projects[i]);
          }
        }
      }
    },
  },
  methods:{
  getProjects(){
    const vm = this;
    vm.loaded = false;
    axios.get(`${config.APP_URL}/api/projects`)
    .then(function (response) {
        vm.projects = response.data;
        vm.shownProjects = response.data;
        window.onload = function() {
          vm.loaded = true;
        };
      });
    },
    goToPage(r){
      this.$router.push('project/' + r);
    },
  }
}
</script>

<style scoped>
  .loading{
    position: absolute;
    width: 50px;
    height: 50px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
  }


  .project-list{
    width: 90%;
    height: 70%;
    position: absolute;
    display: flex;
    display: -webkit-flex;
    flex-wrap: wrap;
    justify-content: flex-start;
    left: 50%;
    top: 65%;
    transform: translate(-50%, -50%);
    align-content: flex-start;
    overflow-y: scroll;
    overflow-x: hidden;
  }

  .project-container{
    width: 33%;
    height: 30vh;
  }

  .project {
    background-color: #2A2A2A;
    color: #FFF;
    font-family: 'Roboto', sans-serif;
    font-size: 18px;
    margin: 8px;
    max-width: 100%;
    min-width: 230px;
    overflow: hidden;
    position: relative;
    text-align: center;
    width: 100%;
    height: 100%;
    cursor: pointer;
  }

  .project * {
    -webkit-box-sizing: border-box;
    box-sizing: border-box;
    -webkit-transition: all 0.45s ease;
    transition: all 0.45s ease;
    cursor: pointer;
  }

  .project:after {
    background-color: var(--overlay-color);
    height: 150%;
    bottom: -145%;
    content: '';
    left: 0;
    right: 0;
    position: absolute;
    -webkit-transition: all 0.2s linear;
    transition: all 0.4s linear;
    cursor: pointer;
  }

  .project img {
    vertical-align: top;
    backface-visibility: hidden;
    max-height: 100%;
    object-fit: cover;
  }

  .project figcaption {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 10%;
    right: 10%;
    align-items: center;
    z-index: 1;
    display: flex;
    width: 80%;
    flex-direction: column;
    justify-content: center;
    line-height: 1.1em;
    opacity: 0;
    -webkit-transition-delay: 0s;
    transition-delay: 0s;
  }

  .project h3 {
    font-size: 1em;
    font-weight: 400;
    letter-spacing: 1px;
    margin: 0;
    text-transform: uppercase;
  }

  .project h3 span {
    display: block;
    font-weight: 700;
  }

  .project a {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 1;
  }

  .project:hover > img,
  .project.hover > img {
    opacity: 0.1;
  }

  .project:hover:after,
  .project.hover:after {
    bottom: 95%;
  }

  .project:hover figcaption,
  .project.hover figcaption {
    opacity: 1;
    -webkit-transition-delay: 0.3s;
    transition-delay: 0.3s;
  }

  .project-fade-leave-active,
  .project-fade-enter-active {
    transition: 0.4s all;
  }
  .project-fade-enter,
  .project-fade-leave-to  {
    opacity: 0;
  }

  @-webkit-keyframes fadeDown {
    0%   {
      top: 4vh;
      opacity: 0;
    }
    100%{
      top: 5vh;
      opacity: 1;
    }
  }

  @-webkit-keyframes fade {
    0%   {
      opacity: 0;
    }
    100%{
      opacity: 1;
    }
  }
</style>

If you would like to take a look at the page yourself, here is the link:

Any assistance with fixing this issue would be greatly appreciated as it has been quite challenging to troubleshoot.

Answer №1

Discovered the problem. It seems that Safari doesn't handle data changes in Vue very well. I included an element that updates when all the other data is loaded, causing everything else to update as well.

Quite odd.

Answer №2

For future reference, I wanted to share some insights on how I got Safari to display the correct data from the state:

  • Make sure to include a v-bind directive in any element that is not updating properly. In my case, I used it like this:

    <div :key="targetObject.guid">
    .

  • Include dummy CSS properties for elements that need to be updated as well. Here are the ones I used:

.problematic-element {
   display: inline-block;
   min-width: 0%;
   transform: translateZ(0);
}

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

The date-picker element cannot be selected by html2canvas

I'm encountering an issue with Html2canvas while trying to capture a screenshot of my page. Specifically, the date shown in the date-picker on the page is not appearing in the screenshot. Do you have any insights into why this might be happening and h ...

Navigating between windows in Selenium with Webdriver - Handling unnamed child windows

Currently, I am conducting acceptance testing using webdriver and codeception. This is a relatively new area for me, so your patience is much appreciated. My current challenge involves switching to a child window that pops up after clicking a button: < ...

Vue component encounters undefined error when passing prop array through component

My challenge is passing an array of dates to my component, but I keep encountering this error: [Vue warn]: Property or method "dates" is not defined on the instance but referenced during render I'm puzzled by this issue because I am receiving the ...

Evaluation of HTML5 file upload functionality with unit testing

How can I perform JavaScript unit testing for file uploads using the HTML 5 File API? Let's consider the following code: <form method="POST" enctype="multipart/form-data"> <input type="file" id="fileselec ...

Attempting to customize react-bootstrap styling within a NextJS application

I'm currently working on a project using Next.js and attempting to integrate Bootstrap as the CSS framework. After installing react-bootstrap into the project, I proceeded to create the navigation bar. My goal is to assign an '.active' class ...

Seems like JavaScript's .active functionality is failing to function properly in my case

I'm encountering an issue with my website's homepage. I have a list of services displayed, and the intention is for a description to appear when one of the services is clicked. However, clicking on the buttons does not trigger the expected action ...

Retrieve a targeted tag from the API snippet

I need to extract the IMG SRC tag from the given code: <pod title="Scientific name" scanner="Data" id="ScientificName:SpeciesData" position="200" error="false" numsubpods="1"> <subpod title=""> <plaintext>Canis lupus familiaris</plain ...

Refresh meta tags in a Next.js/React app

In the process of optimizing a website for SEO, I am facing the challenge of updating the meta description's content dynamically without using any third-party libraries. While I have successfully implemented the functionality, it currently requires a ...

What is the best way to horizontally align Bulma's level items on smaller screens?

My website's footer features a level layout with left and right sections that follow the guidelines provided in theBulma docs. Everything looks good on larger screens. However, on smaller screens, all items in the right section are stacked vertically ...

What is the best way to choose all initial elements within a single row using CSS?

Is it possible to target all the first elements in a single row? I know this is an unusual request, but I have a row that contains block elements. I want to apply CSS styling to each of the first elements. Here is the row: <ul class="slides"> &l ...

Inject environment variable into SCSS file while using webpack

I'm new to webpack and I need help with reading a specific value, which is the env variable from the webpack.config.js file, in a sass file. This will allow me to have different CSS styles based on the environment. For example: If the env is set to ...

Removing a single div box causes a ripple effect on another div box, despite their lack of connection

I'm struggling to remove the white box underneath the "features" section on this website (). The structure of the div is quite simple: <div class="donatenew"></div> and here's the CSS: .donatenew { width:100%; background: #f8f ...

Can someone provide instructions on how to convert base64 data to an image file

I'm utilizing the vue-signature Library but I am unsure how to download the base64 data that is generated as an image. Here is the link to the library: https://www.npmjs.com/package/vue-signature. I have gone through the documentation and noticed that ...

What is the best way to pass the record ID of the row when the user clicks on the edit button?

The substance ID saved to the session is always the last record ID in the table. I need to send the record ID of the row when the user presses the edit button. Currently, every time a button is selected, the record ID sent is the last one in the table. I ...

strange glitch found in jquery ui resizable

Experimenting with jquery UI, I came across an unusual bug. After clicking a button to make a div resizable, the div unexpectedly moves below the button. resizable.html: <html> <head> <link href="my.css" rel="stylesheet" type=" ...

Is it possible to implement a hover animation within another hover animation in WordPress?

Trying to incorporate two hover animations for the images in my photo galleries. When hovering over an image, I want a text to appear in a black overlay, and then when hovering over that text, it should become underlined. Looking for something similar to ...

How can the CSS percentage be converted to pixels for the bottom parameter?

Within my CSS file, I have the following code snippet: #myClass { position: absolute; height: 6px; width: 100%; bottom: 66%; << here is 66% left: 0; right: 0; background-color: #666; cursor: n-resize; } Currently, ...

Enhancing x-axis presentation in D3.js-generated charts

I created a bar chart using D3.js, but I have encountered an issue with one of the values on the x-axis being too long. I attempted to use CSS properties like text-overflow: ellipsis, width: 10px, and overflow: hidden to abbreviate values that exceed a cer ...

Empty Github page displayed on individual professional website

Hello everyone, I am new to development. I recently put together my own personal portfolio and stored it in this GitHub repository -> https://github.com/LuisssM/Portfolio. However, when I try to launch the website at , it shows the content of the read-m ...

How to avoid an additional carriage return in Internet Explorer when editing a Textarea?

In Internet Explorer, we are facing an issue with a multiline textarea. After setting the content using JavaScript and checking it, everything appears correct without any additional carriage returns in the textarea: document.getElementById( 'text-ar ...