To customize the look and feel of the site, we made use of classes provided by SharePoint modern pages (eg: CanvasSection-xl8, CanvasSection, etc.). But soon, there was an update in SharePoint's CSS, due to which we had to rewrite our custom CSS/JS.
Can anyone please let us know which classes are not likely to be changed in the future, since it is not documented anywhere? Also, there is a data-automation-id attribute that is present in the DOM, can we use that or that too can change?
Any suggestions or information is highly appreciated.
Unfortunately you are not going to find a clear answer for this ask :-(. Microsoft makes the kind of changes you mention here without further notice and that ends on breaking custom code that rely in the DOM