Show Scrollbar in Alert in ionic-v4

How to show scroll bar on alert in ionic v4?

1 Like

i did hack but i want permanent solution.

const alert = await this.alertController.create({
    header: 'Info',
    mode: 'md',
    message: '<div style="overflow-y:auto;max-height:240px;">texts</div>',
    buttons: [
      {
        text: 'Close',
        role: 'cancel',
        cssClass: 'secondary',
        handler: (blah) => {
          console.log('Confirm Cancel: blah');
        }
      }
    ]
  });
  await alert.present();
}

43%20pm

how you hack this problem?

Hi, did you find any solution?

IMHO, alerts should be reserved for situations that:

  • need immediate attention
  • are simple, so the user can quickly get back to what they were doing without losing focus

That combination sort of precludes anything that would necessitate a scrollbar, so I don’t think an alert is the appropriate choice. I would use a more generic overlay like a modal.