Can new roof be added to the cost basis of a property sale?

 According to IRS  Publication 523 page 9, new roof is included in the Examples of Improvements That Increase Basis. But when googling there are many experts who answered "No".  Why is it different, and does it have anything to do with whether it is a rental or a primary home? Thank you in advance.